An applet is a Java application that runs in a Web browser. An Java applet extends the java.applet.Applet class, and an applet class will not define main().
<pre><code>
import java.applet.*;
import java.awt.*;
public class HelloWorldApplet extends Applet {
public void paint (Graphics g) {
g.drawString ("Hello World", 25, 50);
}
}
<html>
<title>The Hello, World Applet</title>
<applet code = "HelloWorldApplet.class" width = "320" height = "120">
If your browser was Java-enabled, a "Hello, World" message would appear here.
</applet>
</html>
</code></pre>