In method or class scope, the line below compiles (with warning):
int x = x = 1;
In class scope, where variables get their default valu
In int x = x + 1; you add 1 to x , so what is the value of x, it's not created yet.
int x = x + 1;
x
But in int x=x=1; will compile with no error because you assign 1 to x.
int x=x=1;