aspose file tools
The moose likes Servlets and the fly likes java and servelt Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "java and servelt" Watch "java and servelt" New topic
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
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: java and servelt
 
Similar Threads
zipping as self extracting exe
class
WA #2 ..... word association
J2EE
c++ or Java--your suggestions please