how to write Java Applet lifecycle program (init,start,stop,distroy).

Hello Friends, 


Today I will explain how can we write Java Applet lifecycle program.
In this  program I have print init,start,stop & distroy method.


import java.applet.*;
import java.awt.*;
import java.awt.event.*;
/*


*/

public class second extends Applet
{
String str1="";

public void init()
{
str1 +="init::";
System.out.println("nt "+str1);
}
public void start()
{
str1 +="start::";
System.out.println("nt "+str1);
}
public void stop()
{
str1 +="stop::";
System.out.println("nt "+str1);
}
public void destroy()
{
str1 +="destroy.";
System.out.println("nt "+str1);
}

public void paint(Graphics g)
{
g.drawString(str1,10,25);
}
}

Leave a Reply

Your email address will not be published. Required fields are marked *