HOME      BLOG       FORUMS      CONTACT       ABOUT

Copies the contents of an array to another array

public class SystemExample {
	public static void main(String[] args) {
		int arr1[] ={1,2,3,4,5};
		int arr2[] = new int[5];

		System.arraycopy(arr1, 0, arr2, 0, 5);
		for (int i = 0; i < arr2.length; i++) {
			System.out.println(arr2[i]);
		}
	}
}

Share

Tags: , , ,


You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply