Array expressions in Java
<p>Consider the following expressions in Java.</p>

<pre><code>int[] x={1, 2, 3, 4};
int[] y={5, 6, 7, 0};

x=y;
System.out.println(x[0]);
</code></pre>

<p>Would display <code>5</code> on the console because <code>x</code> is made to point to <code>y</code> through the expression <code>x=y</code> and <code>x[0]</code> would obviously be evaluated to <code>5</code> which is actually the value of <code>y[0]</code>.</p>

<p>When I replace the above two statements with the following statement combining both of them into a single statement,</p>

<pre><code>System.out.println(x[(x=y)[3]]);
</code></pre>

<p>it displays <code>1</code> which is the value of <code>x[0]</code> even though it seems to be equivalent to those above two statements. How?</p>
