Consider the following expressions in Java.
int[] x={1, 2, 3, 4};
int[] y={5, 6, 7, 0};
x=y;
System.out.println(x[0]);
Would display 5 on the console because x is made to point to y through the expression x=y and x[0] would obviously be evaluated to 5 which is actually the value of y[0].
When I replace the above two statements with the following statement combining both of them into a single statement,
System.out.println(x[(x=y)[3]]);
it displays 1 which is the value of x[0] even though it seems to be equivalent to those above two statements. How?