File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes anonymous inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "anonymous inner class" Watch "anonymous inner class" New topic

anonymous inner class

pooja jain
Ranch Hand

Joined: Jan 12, 2005
Posts: 213
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

Joined: Dec 31, 2004
Posts: 961
What do you mean? Somewhat like this satisfies your statement:

ankur rathi
Ranch Hand

Joined: Oct 11, 2004
Posts: 3830
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 ]
I agree. Here's the link:
subject: anonymous inner class
It's not a secret anymore!