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


Please Help Members By Posting Answers For Below Questions

What is ripple effect?

827


What is mdb and what is the special feature of that?

776


Name the eight primitive java types.

809


How would you reatach detached objects to a session when the same object has already been loaded into the session?

917


Is jvm a overhead?

810


How will you pass parameters in RMI? Why do you serialize?

908


What event results from the clicking of a button?

875


what is a portable component?

1654


what is a non-repeatable read?

2024


Where can I find seam examples and documentation?

794


when A client sent a request to the server to open facebook page and close the browser after this request .at that time the same user do login by using a different browser then that session id will exist or not for the same client??

1307


What is JTS?

2063


Why do threads block on i/o?

907


What classes of exceptions may be caught by a catch clause?

756


What is the difference between session and entity beans?

789