Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

argument -defined Anonymous inner class

 
K Anshul
Ranch Hand
Posts: 71
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


iMethod is overridden in an argument. Is there any way i can call iMethod() and print "Argument" on the screen.
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if IFace defines the method you can call it.
If not, tough luck.
 
Sanyev Babu
Ranch Hand
Posts: 132
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Since it is a argument local inner class you can call the overloaded iMethod only from inside the method. The code above will print Argument. but it is called from within the method.

Sanyev
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic