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]);
5 appears 5 the console because x will point to y through the expression x=y and x[0] , obviously it will be evaluated as 5 , which is actually the value of y[0] .
When I replace the above two operators with the following statement, combining both of them into one operator,
System.out.println(x[(x=y)[3]]);
it displays 1 , which is the value of x[0] , even if it seems to be equivalent to the one above of the two operators. How?
source share