小弟有个小问题求教一下:代码如下:
int[][] a = new int[2][2];
int[][] b = new int[2][2];
int temp = 45;
int temp2 = 55;
for (int i = 0; i < 2; i++) {
    for (int j = 0; j < 2; j++) {
      a[i][j] = 10;
      b[i][j] = 11;
      System.out.println( "a1[" + i + "][" + j + "]==== " + a[i][j] + "   temp=== " + temp + "   temp2=== "+temp2);
      temp = a[1][1];           
      temp2 = b[1][1];
              System.out.println( "a2[" + i + "][" + j + "]==== " + a[i][j] + "   temp=== " + temp + "   temp2=== "+temp2);
      System.out.println("-------------------------------");
     }
}运行之后打印出来的值为:
a1[0][0]==== 10   temp=== 45  temp2=== 55
a2[0][0]==== 10   temp=== 0   temp2=== 0
-------------------------------
a1[0][1]==== 10   temp=== 0   temp2=== 0
a2[0][1]==== 10   temp=== 0   temp2=== 0
-------------------------------
a1[1][0]==== 10   temp=== 0   temp2=== 0
a2[1][0]==== 10   temp=== 0   temp2=== 0
-------------------------------
a1[1][1]==== 10   temp=== 0   temp2=== 0
a2[1][1]==== 10   temp=== 10  temp2=== 11
-------------------------------
一直没有想明白,为什么在
a2[0][0]==== 10   temp=== 0   temp2=== 0
-------------------------------
a1[0][1]==== 10   temp=== 0   temp2=== 0
a2[0][1]==== 10   temp=== 0   temp2=== 0
-------------------------------
a1[1][0]==== 10   temp=== 0   temp2=== 0
a2[1][0]==== 10   temp=== 0   temp2=== 0
这中间,temp和temp2的值会变成0呢?
求教各位高手。