This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
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 The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript 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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: what is the difference between 2 init() methods.