当前位置: 技术问答>java相关
为什么两个数组在输出的时候是一样的?
来源: 互联网 发布时间:2015-05-03
本文导语: 现有两个数组,为什么输出是一样的? 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 = thisA...
现有两个数组,为什么输出是一样的?
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
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