KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > ArrayCloneTests


1 public class ArrayCloneTests {
2
3     public static void main(String JavaDoc[] args) {
4         int ia1[] = { 1, 2 };
5         int ia2[] = (int[])ia1.clone();
6         System.out.print((ia1 == ia2) + " ");
7         ia1[1]++;
8         System.out.println(ia2[1]);
9     
10         int ia[][] = { { 1 , 2}, null };
11         int ja[][] = (int[][])ia.clone();
12         System.out.print((ia == ja) + " ");
13         System.out.println(ia[0] == ja[0] && ia[1] == ja[1]);
14     }
15 }
16
Popular Tags