This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Applets and the fly likes init() method Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Applets
Bookmark "init() method" Watch "init() method" New topic

init() method

tilak kumar

Joined: Feb 16, 2005
Posts: 15
instead of init() mathod can we declare our own constructor
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24183

You can define a contructor, yes, but there are things you can only do in init(). In particular, your "AppletStub" won't be set, yet, while the constructor is running, so you can't get applet parameters, load images from URLs, load sound files, etc. All of these things have to be deferred until init() time.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: init() method
Similar Threads
loading of static attributtes
Calling init()
Init and Constructor
init methods of Servlets: need clarification
ServletA extend ServletB right or wrong ?