Can we write a constructor for a Servlet class ? if yes how ?
if no why not ?
Answer Posted / chandra
constructor required, but it should be public no-argument
constructor. even though if you are not write that
constructor java compiler will create that construtctor by
default. for that your servlet class should be public other
wise you will get RuntimeWxception saying RequestedResource
is not available like that.
Is This Answer Correct ? | 9 Yes | 2 No |
Post New Answer View All Answers
What are the mechanisms used by a servlet container for maintaining session information?
What are the advantages of Servlet over CGI?
What is a web container and what is its responsibility?
Explain the working of service() method of a servlet.
What is meant by a servlet?
Name the different ways of session tracking.
What are its drawbacks of cgi?
What are different methods of session management in servlets?
Explain the lifecycle of a servlet?
Can you refresh servlet in client and server-side automatically?
What exactly are the functions of servlet?
What is cookie? Why is cookie used?
Difference between get and post in java servlets?
How servlets are deployed in java?
What is the difference between Server and Container?