A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Java in General
Is it possible to create a constructor for anonymous inner class
Joined: Jan 08, 2008
Jan 18, 2008 02:13:00
Is it possible to create a constructor for anonymous inner class? If so, how?
***<br />K Vinod Reddy
Joined: Oct 15, 2007
Jan 18, 2008 02:49:00
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
does an anonymous inner class have constructor?
Initializing instance variables in java
Q: Anonymous inner class extending outer class
Can JPanel's paint() use different Graphics2D objects?
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2014