File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Applets and the fly likes init vs. constructor Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "init vs. constructor" Watch "init vs. constructor" New topic
Author

init vs. constructor

Drew Lane
Ranch Hand

Joined: May 13, 2001
Posts: 296
What's the difference between using init() and a no arg contructor in an applet?
It seems like they do about the same thing. (?)
Thanks!
Drew
Nathan Pruett
Bartender

Joined: Oct 18, 2000
Posts: 4121

The problem is that the browser doesn't know how to call a no-argument constructor of an applet! init() is one of the few methods that the browser knows how to call in an applet ( start(), stop(), and destroy() are the others ). Init is used when the applet is first called from a webpage. It's basically what the browser calls when it first says "I need an applet like this"... the actual constructor would be called before init() however...

For more info, look at the applet section of the Java tutorial by Sun... http://java.sun.com/docs/books/tutorial/applet/overview/index.html

-Nate
[This message has been edited by Nathan Pruett (edited July 16, 2001).]


-Nate
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: init vs. constructor