This week's book giveaway is in the Android forum.
We're giving away four copies of Head First Android and have Dawn & David Griffiths on-line!
See this thread for details.
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes Doubt in init method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "Doubt in init method" Watch "Doubt in init method" New topic

Doubt in init method

Abhishek Mantri

Joined: Sep 06, 2007
Posts: 25
If we override init method which takes (ServletConfig) as argument then why should we call super.init(ServletConfig)??
Joy Mookerji
Ranch Hand

Joined: Jul 26, 2006
Posts: 49
Because the init(ServletConfig) from the GeneriServlet class gives the Servlet the the ServletConfig object (one per servlet) which can be used later on by the Servlet to get access to its say init-params.
This is done by the container so if you want to override the method you should call the super.init(ServletConfig).

SCJP 5<br />Brainbench Certified in C++<br />PMP<br />Dallas,TX
Abhishek Mantri

Joined: Sep 06, 2007
Posts: 25
Thanks Joy !
jQuery in Action, 3rd edition
subject: Doubt in init method
It's not a secret anymore!