展开全部
public class CopyArr {
public static void copy(int[] fromArr, int[] toArr){
if(null==fromArr){
return ;
}
for(int index=0; index
toArr[index]=fromArr[index];
}
}
public static void display(int[] arr){
if(null==arr){
return ;
}
for(int index=0; index
System.out.print(arr[index]+" ");
}
}
public static void main(String[] args){
int[] fArr= {123,456,789,0,1,-90};
int[] tArr= new int[fArr.length];
System.out.println("\n---------- From Arr ---------------");
display(fArr);
System.out.println("\n---------- To Arr ---------------");
display(tArr);
copy(fArr,tArr);
System.out.println("\n---------- From Arr ---------------");
display(fArr);
System.out.println("\n----------CopyTo Arr ---------------");
display(tArr);
}
}