public class Conversions {
public static void main(String[] args) {
int index = 3;
int[] arr = new int[] { 10, 20, 30, 40};
arr[index] = index = 2; //(1)
System.out.println("" + arr[3] + " " + arr[2]);
}
}
我有这个,它会给出:
2 30
I was hoping it will give
40 2
为什么在赋值时索引的值没有改为2而是保持为3?
(1)