This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes Java in General and the fly likes what is significance of final AB this$0; Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Java in General
Bookmark "what is significance of final AB this$0;" Watch "what is significance of final AB this$0;" New topic

what is significance of final AB this$0;

gauravkv gupta

Joined: Feb 18, 2012
Posts: 21
source code:

using the javap tool, i got the following, but i dont understand the purpose of adding these statement by compiler. please explain the usefulness of added code by compiler.
Compiled from ""

what is significance of final AB this$0;

[Added code tags]
Alexei Kaigorodov

Joined: Feb 24, 2008
Posts: 17
means reference to an instance of enclosing class AB. This reference is required to access fields amd methods of AB from within nested class B.
Matthew Brown

Joined: Apr 06, 2010
Posts: 4541

You know that an inner class can access member variables and methods in the enclosing object, right? Well, this is how the compiler makes that possible. It passes a reference to the enclosing object into the inner class, via a constructor that it generates.

If you modified your original code to call a method in the enclosing object, you'll find that in the decompiled version the call is prefixed with this this$0 reference.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: what is significance of final AB this$0;
It's not a secret anymore!