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

Answer Posted / narayana rao dasari

yes.....! we can write constructor for servlet class why
because every java class allows construction initialization
if we do not write constructor explicitly it will call
default constructior.

If we call our own constructiors means we will not able to
access the servelet config objects so better wat is to
intializeing in init() method......thank u,
Narayan

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to handle exceptions thrown by application with another servlet?

796


What exception should be thrown when servlet is not properly initialized?

753


Is that servlet is pure java object or not?

805


Which is the methods of generated servlet?

874


What's the difference between authentication and authorization?

758


What is the effective way to make sure all the servlets are accessible only when user has a valid session?

781


What are the advantages of Servlet over CGI?

855


What is the difference in between the httpservlet and generic servlet?

831


Explain the differences between jsp and servlet.

720


List the Different types of servlet?

774


What do you mean by session tracking?

894


What is servlet lazy loading?

882


What is http servlet?

777


List out the difference between ServletConfig and ServletContext?

774


What is a cookie What is the difference between session and cookie

799