Chaining array assignment in Java
<p>Consider the following code snippet in Java. I know that the statement <code>temp[index] = index = 0;</code> in the following code snippet is pretty much unacceptable but it may be necessary in some situations and hence, there is a need to know.</p>

<pre><code>package arraypkg;

final public class Main
{
    public static void main(String... args)
    {
        int[]temp=new int[]{4,3,2,1};
        int index = 1;

        temp[index] = index = 0;
        System.out.println("temp[0] = "+temp[0]);
        System.out.println("temp[1] = "+temp[1]);
    }
}
</code></pre>

<hr>

<p>It displays the following output on the console.</p>

<pre><code>temp[0] = 4
temp[1] = 0
</code></pre>

<hr>

<p>I don't understand this statement <code>temp[index] = index = 0;</code>. How does <code>temp[1]</code> contain <code>0</code>? How does this assignment occur?</p>
