File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes Anonymous Inner Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Anonymous Inner Class" Watch "Anonymous Inner Class" New topic
Author

Anonymous Inner Class

Sen George
Ranch Hand

Joined: Sep 21, 2005
Posts: 76
In the following code listing, please explain why the output " prAnon procedure" is not generated.

Jeanne Boyarsky
author & internet detective
Marshal

Joined: May 26, 2003
Posts: 31057
    
232

Sen,
Where does prAnon get called? It's just a method. If it doesn't get called, it doesn't print anything.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Bert Bates
author
Sheriff

Joined: Oct 14, 2002
Posts: 8883
    
    5
moved to the intermediate forum


Spot false dilemmas now, ask me how!
(If you're not on the edge, you're taking up too much room.)
marc weber
Sheriff

Joined: Aug 31, 2004
Posts: 11343

Just a guess on what might be causing the misunderstanding...

In the syntax for an anonymous inner class, the constructor call is followed by the anonymous class definition -- not the body of the constructor.

So the code within the braces does not execute with "new."


"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer
sscce.org
Sen George
Ranch Hand

Joined: Sep 21, 2005
Posts: 76
How can I incorporate a call to invoke the method defined in an anonymous class?
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Anonymous Inner Class