aspose file tools*
The moose likes Servlets and the fly likes why do we need init() , when we have constructor? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply locked New topic
Author

why do we need init() , when we have constructor?

shivaprasad patla
Greenhorn

Joined: Jun 26, 2008
Posts: 7
Hi Guys, I am started studying servlets first time, I have been asked one simple question,

why do we need init() method, when we have servlet constructor to perform initialization things?

My Ans: because we may need to pass objects to initialize,and init() can be overloaded where as servlet constructor can not.
Am I correct? please confirm and provide me some more information if you have.

Cheers...
Shiva


Cheers.....<br /> <br />shiva<br />SCJP 1.5<br />Preparing for SCWCD
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60056
    
  65

Please check the Servlets FAQ before posting to see if your question has already been addressed, as this one has.
[ October 16, 2008: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: why do we need init() , when we have constructor?
 
Similar Threads
use of init() in servlet life cycle
Why Init Method, why can't we use constructor instead?
Init and Constructor
Regarding the init() methods
Why does a servlet has init method