| Author |
java and servelt
|
bharath simha
Greenhorn
Joined: Mar 22, 2004
Posts: 1
|
|
|
What is diffrence between init() and constructor in java?
|
 |
Amit KumarS
Ranch Hand
Joined: Oct 10, 2003
Posts: 100
|
|
hi bharat, both are more or less the same..but the difference lies in the way that it is used.. constructor are written in simple java classes.. but init() methods are written in servlets. constructors are invoked whenever an object of that class is created. where as when you deploy a servlet init() is called for the first time when that servlet is accessed and and rest of the times when severakl client try to access the same servlet only a new thread is spawned but the object is same. this object is unloaded from memory only when server is shut down. i hope you got the difference. if still in doubt then revert back Bye
|
****************************<br />In 24 hrs Earth rotates once on its Axis.
|
 |
Malhar Barai
Author
Ranch Hand
Joined: Aug 17, 2001
Posts: 399
|
|
Hi.. Check this out.. hth
|
Malhar Barai
SOA & Java Book
|
 |
 |
|
|
subject: java and servelt
|
|
|