• Post Reply Bookmark Topic Watch Topic
  • New Topic

Doubt in servlet  RSS feed

 
Kirun krow
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can a servlet have constructor ?
If yes what is the use
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Every Java class has a constructor.
In the case of servlets, the only constructor that will ever be called is the zero argument constructor.

If you need to do some initialization when your servlet is loaded, do it in the init method.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!