This week's book giveaways are in the Refactoring and Agile forums.
We're giving away four copies each of Re-engineering Legacy Software and Docker in Action and have the authors on-line!
See this thread and this one for details.
Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applets

 
Raveendran Karunakaran
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Applets do not have a main() method how come they work ?
 
rani bedi
Ranch Hand
Posts: 358
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
An applet is a small program that is intended not to be run on its own, but rather to be embedded inside another application.
We write an applet by making it a subclass of the Applet class. The class overrides four Applet methods so that it can respond to major events:
init()
To initialize the applet each time it's loaded (or reloaded).
start()
To start the applet's execution, such as when the applet's loaded or when the user revisits a page that contains the applet.
stop()
To stop the applet's execution, such as when the user leaves the applet's page or quits the browser.
destroy()
To perform a final cleanup in preparation for unloading.
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are running an Applet the BROWSER is actually the program that is running and it was probably not written in java. The four methods that Applets use are a "contract" or agreement between java and the browser so that you can give the browser instructions on how to start, maintain and close down your Applet.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic