aspose file tools
The moose likes Servlets and the fly likes what is the difference between 2 init() methods. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "what is the difference between 2 init() methods." Watch "what is the difference between 2 init() methods." New topic
Author

what is the difference between 2 init() methods.

chandra kunchala
Greenhorn

Joined: Aug 06, 2008
Posts: 17
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.


Thanks & Regards
Chandra SCJP5.0
Matteo Di Furia
Ranch Hand

Joined: Jun 20, 2008
Posts: 102
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.
 
subject: what is the difference between 2 init() methods.