我们首先看代码:
int[] a = {1, 2, 3};
int[] b = {4, 5, 6};
a=b;
a[0]=200;
for (int i = 0; i <a.length ; i++) {
System.out.println(a[i]);
}
for (int i = 0; i <b.length ; i++) {
System.out.println(b[i]);
}
运行结果如下:
200
5
6
200
5
6