Ash,
I think you are not getting a compile error because the local variable is shadowing the member variable. The Java Specification says
"A declaration d of a field, local variable, method parameter, constructor parameter or exception handler parameter named n shadows the declarations of any other
fields, local variables, method parameters, constructor parameters or exception handler parameters named n that are in scope at the point where d occurs
throughout the scope of d."
Try the following code:
The output is
12
5
because the local i shadows the member i, which can be referred to by class name because it is static.
Hope this helps.