Hi Barkat,
The code compiles when commenting out
field1 in Super because Super doesn't see it. In the code, the type declarations are hidden in the child class, but no method is overridden, so
polymorphism doesn't hold. It's all about static binding. So, in
aMethod() we have:
this.new Inner() creates an object of Inner class defined in Super even though the currently running object
this is of
Test type. Same thing happens with
new Inner_Static(); call. To print out the field1 variable, you can downcast
this to Test. Would you agree?