This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Servlets and the fly likes instance of servlet Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "instance of servlet" Watch "instance of servlet" New topic
Author

instance of servlet

Arun Maalik
Ranch Hand

Joined: Oct 25, 2005
Posts: 216
Dear sir

I know that instance of servlet is created when init() method is called but in book of head first it has been written that init() method is called after creation of instance please specify these things.

Actualy what is the instance of a servlet ?

Thanks

Arun kumar maalik
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61447
    
  67

A method cannot be called on an instance of an object until after it has been created. So init() can't create the servlet instance, it is called by the container after the instance has been created.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Rahul Bhattacharjee
Ranch Hand

Joined: Nov 29, 2005
Posts: 2308
Servlets are no different.They are also like other java classes.
So you need to create instance before calling method init().


Rahul Bhattacharjee
LinkedIn - Blog
 
jQuery in Action, 2nd edition
 
subject: instance of servlet