A Simple Java Applet

The following program is a simple Java Applet. Don't worry if it looks confusing now. Java applets will be the main focus of these lectures and labs. The program will be explained in detail in the next lecture. By the time you're done with all the lectures and labs you will feel pretty comfortable with applets.

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

public class HelloWorld extends Applet {
	public void paint(Graphics g) {
		g.drawString("Hello World!", 25, 25);
	}
}

To compile this program, type:

	javac HelloWorld.java

To see the applet, you need to embed the applet within an HTML file, which will be explained later.


Back to Lecture1