Can we define constructor in Servlet class?

Answer Posted / sanjeev kumar

We never can create the Servlet instance. hence there is no
chance of having constructor in servlets. Servlet life
cycle methods (init(), service(), destoy())are called by
the servlet container.

Is This Answer Correct ?    4 Yes 8 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

If a servlet is not properly initialized, what exception may be thrown?

623


What is meant by session? Tell me something about httpsession class?

596


Can you send an authentication error from a servlet?

515


Why is init() method is used in servlets?

552


What do you mean by web applications? Explain web application directory arrangement?

534






What is the dispatcher servlet?

509


What is the web server used for running the Servlets?

575


What is servlet mapping?

593


Explain the servlet context.

596


Which is better jsp or servlet?

553


How do we share data using 'getservletcontext ()?

537


How servlet is created?

540


What is the difference between the getrequestdispatcher(string path) method of javax.servlet.servletrequest interface and javax.servlet.servletcontext interface?

559


What is a java servlet?

552


Explain in brief the directory structure of a web application?

566