This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Servlets and the fly likes init method code ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "init method code ?" Watch "init method code ?" New topic

init method code ?

Rahul Juneja
Ranch Hand

Joined: Aug 03, 2002
Posts: 425
Will this Code work fine ? Please note super.init() is not the first line.

Rahul Juneja
ThoughtClicks -
Nathaniel Stoddard
Ranch Hand

Joined: May 29, 2003
Posts: 1258
If your question is actually "Can I call 'super.init' anywhere in a method and not necessarily on the first line: yes, you can. A call to a super constructor has to be the first line, or a call to a separate constructor has to be on the first line. But calling an overridden method can be done at any point in the method.

I agree. Here's the link:
subject: init method code ?
Similar Threads
Hibernate Problem
init() method usage
why super.init() is used??
Which one gets first executed ?????????
servlet cant see getServletContext() from inheritance