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 Is it possible to create a constructor for anonymous inner class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Is it possible to create a constructor for anonymous inner class" Watch "Is it possible to create a constructor for anonymous inner class" New topic
Author

Is it possible to create a constructor for anonymous inner class

vinodreddy kisanagaram
Greenhorn

Joined: Jan 08, 2008
Posts: 9
Is it possible to create a constructor for anonymous inner class? If so, how?


***<br />K Vinod Reddy
Kishore Kumar
Ranch Hand

Joined: Oct 15, 2007
Posts: 71
No, you cannot have a constructor in an anonymus class, because you don't have the name of the class. Instead you can add an instance initialization block which acts like a constructor.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Is it possible to create a constructor for anonymous inner class