main.java
import java.awt.Graphics; import java.applet.Applet; public class main extends Applet { public void paint(Graphics g) { g.drawString("Hello, world!", 10, 10); } }
編譯
$ javac main.java
main.html
<html> <body> <applet code="main.class" width="200" height="100"> </applet> </body> </html>
執行
$ appletviewer main.html
完成