File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

access inner class method

 
vivi santa
Greenhorn
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
say I got an inner class and have method A, how can the outer class access method A?

thanks
 
krishna avrs
Greenhorn
Posts: 4
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic