Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

anonymous inner class

 
pooja jain
greenhorn
Ranch Hand
Posts: 213
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It is mention in Kathy & Bert book on 467 page . you can even have class within an argument of method that are anonymous inner class . but my doubt is they are not in method argument .
 
Edwin Dalorzo
Ranch Hand
Posts: 961
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What do you mean? Somewhat like this satisfies your statement:

 
ankur rathi
Ranch Hand
Posts: 3830
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
new Base() { int i = 8 ; } ;

Pooja , You can consider this line like , this line is giving an reference of an anonymous class & that anonymous calss is a sub class of this Base class & implementation of that anonymous class is b/w the curly braces ...

So now you can have this statement any place where ever reference is required , in method argument, at the time of assigning to another reference ...

I hope it is right & clear to you ...
[ January 14, 2005: Message edited by: rathi ji ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic