x = 0; // global scope y = 1; z = 2; { x = 3; // local scope { y = 4; // nested local scope x + y + z; } } In Java, local variable cannot hide other local variables, but local variable can hide static class variables. Also, Java does not allow variables in the global scope (only class definitions). { static x = 0; // local (class) scope static y = 1; static z = 2; { x = 3; // nested local scope { y = 4; // nested local scope x + y + z; } } }