This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what is the difference between 2 init() methods.

 
chandra kunchala
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All
Any body tell me that.
we have 2 init() methods in GenericServlet right?
can you tell me the difference between these 2 init() methods.
 
Matteo Di Furia
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you read the JavaDoc of GenericServlet, you'll find that the container will call init(ServletConfig). For convenience sake, the method init() will be called by init(config) and you only need to override init() to do what you have, so you don't have to worry about getting a ServletConfig object somewhere. As you can also read in init() JavaDoc, calling getServletConfig() will return a ServletConfig even if you've overridden init() method only.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic