public class IntegerArray{
public static void main(String[] args){
Integer[] scores1 = new Integer[]{1,2,3,4,5};
Integer[] scores2 = new Integer[scores1.length];
for(int i = 0; i < scores1.length; i++){
scores2[i] = scores1[i];
}
for(Integer score2: scores2){
System.out.print(score2);
}
System.out.println();
scores2[0] = 7;
for(Integer score1 : scores1){
System.out.print(score1);
}
System.out.println();
for(Integer score2: scores2){
System.out.print(score2);
}
}
}
结果:
12345
12345
72345