,
a [a [b]] = a [b] = b = 2;
from right to left and expecting the array and b to be reevaluated at every step, when it actually seems that a and b are frozen during the assignment. Consider the equivalent code:
1) int b = 2;
2) int[] a= new int[4];
3) a[a[b]] = 2
4) a[b]= 2
5) b=2;
source
share