This week's book giveaways are in the iOS and Features new in Java 8 forums.
We're giving away four copies each of Barcodes with iOS: Bringing together the digital and physical worlds and Core Java for the Impatient and have the authors on-line!
See this thread and this one for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes access inner class method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Barcodes with iOS this week in the iOS forum
or Core Java for the Impatient in the Java 8 forum!

JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "access inner class method" Watch "access inner class method" New topic
Author

access inner class method

vivi santa
Greenhorn

Joined: Feb 02, 2001
Posts: 26
say I got an inner class and have method A, how can the outer class access method A?

thanks
krishna avrs
Greenhorn

Joined: May 23, 2001
Posts: 4
If all are non-static then new outer().new inner().methodA();
If all are static then outer.inner.method();
If outer is static and inner is non-static then outer.new inner().method();
If outer is non-static and inner is static then new outer().inner.method();
Hope this helps!
Cheers!
SriKi.
 
wood burning stoves
 
subject: access inner class method