This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes reference problem within inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "reference problem within inner class" Watch "reference problem within inner class" New topic
Author

reference problem within inner class

miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
inside my class Gui i've an anonymous inner class; from inside this inner class i need a reference to the outer class

how i did it: inside outer constructor,

then, inside inner, i used 'gui';

isnt there a better way?

TiA


java amateur
Ariel Ortiz
Ranch Hand

Joined: May 14, 2004
Posts: 121
If the name of the outer class is , you can use the following within the inner class:

...Ariel
miguel lisboa
Ranch Hand

Joined: Feb 08, 2004
Posts: 1281
i tested, it works and looks much cleaner

thanks for that
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: reference problem within inner class
 
Similar Threads
How to reference outer class from within inner class
Inner Classes
Cannot this an outer class instance from an inner class?
Generics: cannot make a static reference to the non-static type
Inner Class