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 are the benefits of detached objects?
What is the purpose of the notifyall() method?
What is the difference between the font and fontmetrics classes?
What is the diffrence between a local-tx-datasource and a xa-datasource? Can you use transactions in both?
What do you know about seam?
What is ripple effect?
What must a class do to implement an interface?
What is the immediate superclass of the applet class?
Why are component architectures useful?
How can I avoid validating a form before data is entered?
What is threadfactory?
What is the highest-level event class of the event-delegation model?
What is the difference between the string and stringbuffer classes?
what are the advantages of JTA over JTS?
What is the difference between the ‘font’ and ‘fontmetrics’ class?