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 Murach's Java Servlets and JSP this week in the Servlets 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.
 
 
subject: Is it possible to create a constructor for anonymous inner class
 
Similar Threads
Q: Anonymous inner class extending outer class
does an anonymous inner class have constructor?
Initializing instance variables in java
Can JPanel's paint() use different Graphics2D objects?