为什么两个数组在输出的时候是一样的?
weity 2002-04-09 03:05:29 现有两个数组,为什么输出是一样的?
public class SCJPExam01 {
public static void main(String Args[]){
int [ ] thisArray = {10,9,8,7,1,1,1,1,1,1,1};
int [ ] thatArray;
//here how to do?
thatArray = thisArray;
int usedArray[ ] = {0,1,2,3,4,5,6,7,8,9,10};
//copy usedArray to thisArray;
System.arraycopy(usedArray, 0, thisArray, 0, usedArray.length);
for(int i=0;i< usedArray.length;i++){
System.out.println("thisArray[" + i + "]=" + thisArray[i]);
System.out.println("thatArray[" + i + "]=" + thatArray[i]);
}
}
}