5
public class Main{
    public static void main(String[] args){
        int a = 0;
        int[] b = new int[5];
        int c = 3;
        b[a] = a = 3;//a is covered with 3, why the entry assigned with 3 is b[0] instead of b[3]
        System.err.println(b[0]);
        System.err.println(b[3]);
        System.err.println(b[a]);
    }
}

The output is :

3
0
0

I guess the reason may be fifth like Intermediate variable buffer, but i'm still not quite sure about how the statement b[a] = a = 3; works.

eLRuLL
  • 18,488
  • 9
  • 73
  • 99
lanx86
  • 177
  • 6

0 Answers0