Creating an Executable Applet in Java

An executable applet is nothing but the .class file of the applet which is obtained by compiling the source code of the applet. Compiling an applet is the same as compiling an application.

import java.applet.*;
import java.awt.*;

public class test extends Applet 
   public void paint(Graphics g) 
      g.drawString("Hello World",50,20);

Create an HTML File and adding it with the Applet

         <applet code = "test.class" width = "600" height = "400"></applet>

Note: We must name this file as test.html and save it in the same directory as the compiled applet.