Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

init vs. constructor

 
Drew Lane
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic