Can we define constructors in Servlet?
Answer Posted / qim2010
One can definitely have constructor in servlet. Even you can
use the constructor in servlet for initialization purpose,
but this type of approach is not so common. You can perform
common operations with the constructor as you normally do.
The only thing is that you cannot call that constructor
explicitly by the new keyword as we normally do. In the case
of servlet, servlet container is responsible for
instantiating the servlet, so the constructor is also called
by servlet container only.
| Is This Answer Correct ? | 1 Yes | 0 No |
Post New Answer View All Answers
How many times may an objects finalize() method be invoked by the garbage collector?
What method is invoked to cause an object to begin executing as a separate thread?
Where can I ask questions and make suggestions about seam?
Why are some of the class and element names counter-intuitive?
What is the difference between the session.update() method and the session.lock() method?
What are the services in RMI ?
Is infobus easy to use?
What is the difference between RMI registry and OS Agent?
When a thread blocks on i/o?
What is the form of storage space in java?
Can constructors be synchronized in java?
what is meant by JRMP?
What is glasgow?
If your ui seems to freeze periodically, what might be a likely reason?
What modifiers may be used with an interface declaration?