1 public class ArrayOfPrimitives { 2 3 public static void main(String[]args){ 4 int[]a1={1,2,3,4,5}; 5 int[]a2; 6 a2=a1; 7 8 for(int i=0;i<a1.length;i++) 9 a2[i]+=1; 10 for(int i=0;i<a1.length;i++) 11 System.out.println(a1[i]); 12 } 13 }
输出
2 3 4 5 6