In method or class scope, the line below compiles (with warning):
int x = x = 1;
In class scope, where variables get their default valu
x is not initialised in x = x + 1;.
x = x + 1
The Java programming language is statically-typed, which means that all variables must first be declared before they can be used.
See primitive data types