Skip to content
Advertisement

Tag: shadowing

Can anyone explain this code related to shadowing in Java?

While going through Oracle docs reading about Nested classes, I found this piece of code whose output I could not understand. Can someone please explain this ? The following is the output of this example: The original code can be found here Answer The local variable x shadows this.x and ShadowTest.this.x. The instance variable of the inner class (this.x) shadows

Advertisement