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
我希望它会给
40 2
在 (1) 为什么赋值中的索引值没有更改为 2(并保持为 3)。?