Tuesday, April 17, 2007
Why there are no constructors in servlets?
Subscribe to:
Post Comments (Atom)
World of tricky Core Java Q&A(Java SE),Java EE and Open source technologies like Struts,Hibernate,Spring,Velocity etc
Disclaimer
Interview Questions On Java,Java EE Copyright © 2012
2 comments:
Yes of-course you can have the constructors instead of init().But you shouldn't originally ancient java couldn't invoke constructors with parameters through reflection.
Who said servlet does not has constructor. Every class in java has a default constructor at least and servlet is also is a class so it also has a default constructor. If we talk about constructor with argument then we don't need it because servlet has init() method for initialization purpose.
Post a Comment