Java-Init and Start

Init

The init( ) method is the first method to be called. The init( ) method is called by the browser when the applet begins execution. This method is called only once during the run time of your applet.

start

The start( ) method is executed after the init( ) method completes its execution. This method is also called by the web browser or the appletviewer to resume the execution of an applet. When a user moves from a web page that contains the applet to another web page, the execution of an applet will be stopped. When the user returns to the page that contains the applet, the execution of that applet will be resumed. Remember that the start( ) method will be called whenever the execution of an applet is to be resumed.

Program

0

Program Source

import java.applet.Applet;
import java.awt.Graphics;

public class Javaapp extends Applet {
    
    String str = "hajsof";
    
    public void init()
    {
        str+="java";
    }
    
    public void start()
    {
        str+="tutorial";
    }
    
    public void paint(Graphics g)
    {
        g.drawString(str, 100, 100);
    }
}

Leave a Comment