Applet Life Cycle in Java
Applets are small java programs that are primarily used in internet computing. It can be transported over the internet from one computer to another and run using the Applet Viewer or any web browser that supports Java. An applet is like an application program, it can do many things for us. It can perform arithmetic operations, display graphics, create animation & games, play sounds and accept user input, etc.
Every Java applet inherits a set of default behaviours from the Applet class. As a result, when an applet is loaded, it undergoes a series of changes in its states.
Applet Life Cycle:
The methods to execute in the Applet Life Cycle are init(), start(), stop(), destroy(). The Applet Life Cycle Diagram is given as below:
- Born or Initialization State
- Running State
- Idle State
- Dead State
Applet Life Cycle Program:
<html> <head> </head> <body> <applet code = "AppletLifeCycle.class" width = "240" height = "360"></applet> </body> </html>