Can we write a constructor for a Servlet class ? if yes how ?
if no why not ?

Answer Posted / sekhar babu

yes, we can write constructor on our own but it should be
no argument public constructor only, cause container will
create the object so it needs no argument constructor.

Is This Answer Correct ?    22 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What do you mean by deployment descriptor?

557


How the servlet is loaded?

602


How can we implement a jsp page?

632


What is the difference between encodeRedirectUrl and encodeURL?

607


What is the need of servlet filters?

543






Explain request dispatcher and its methods.

591


Explain the concept of ssi ?

595


What does the term localization refer to?

586


What do you mean by httpservlet and how it is different from the genericservlet?

542


Can you call a jsp from the servlet?

548


Explain the difference between servletconfig and servletcontext in servlet?

577


Does servlet have main method?

691


Which method is called when reference variable is passed in system.net?

1838


What is the importance of init() method in Servlet ?

594


How do I use cookies to store session state on the client?

538