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
What is the purpose of the notify() method?
Explain what is synchronization?
Explain about thread synchronization inside a monitor?
Do I need to import javlang package any time? Why ?
Is a class a subclass of itself?
How to pass parameters in RMI?
What is the difference between RMI and Corba?
What is the difference between the ‘font’ and ‘fontmetrics’ class?
Explain phantom read?
Have you used threads in Servelet?
Is the session factory thread safe?
How substring() method of string class create memory leaks?
What is the difference between static and non-static with examples?
What is the purpose of the finally clause of a try-catch-finally statement?
whats is mean by tiles in struts