When servlet is initialised, init() method is called which initialize objects. What is the use of init() method when both constructor and init() serves the same purpose i.e initialization of object
Asked
Active
Viewed 102 times
0
-
In Init() method can be do initialization of some object like a database. Maybe a simple tutorial as http://www.tutorialspoint.com/servlets/servlets-life-cycle.htm can clarify. – Mihai8 Feb 25 '15 at 15:06
-
Refer: http://stackoverflow.com/questions/9381356/why-we-use-init-rather-constructor The accepted answer, answers your question too. – Anurag Kapur Feb 25 '15 at 15:10