File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Applets Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Applets" Watch "Applets" New topic


Raveendran Karunakaran
Ranch Hand

Joined: Jun 25, 2001
Posts: 38

Applets do not have a main() method how come they work ?
rani bedi
Ranch Hand

Joined: Feb 06, 2001
Posts: 358
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:
To initialize the applet each time it's loaded (or reloaded).
To start the applet's execution, such as when the applet's loaded or when the user revisits a page that contains the applet.
To stop the applet's execution, such as when the user leaves the applet's page or quits the browser.
To perform a final cleanup in preparation for unloading.

Cheers,<br />Rani<br />SCJP, SCWCD, SCBCD
Cindy Glass
"The Hood"

Joined: Sep 29, 2000
Posts: 8521
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.

"JavaRanch, where the deer and the Certified play" - David O'Meara
I agree. Here's the link:
subject: Applets
It's not a secret anymore!