What is the difference between a program and an applet?

Applets:

Applets do not live in a page as is commonly perceived. Applets are actually Java classes identified via HyperText Markup Language (HTML) tags within Web documents, it is these HTML tags that are embedded within Web documents. Java Applets are loaded from Web Servers somewhere on the Internet or within your corporate Intranet or Extranet.

Applications:

Java applications fit the traditional application model in the sense that they are executed from a command line and need to be installed on, or migrated to, each application host machine and then executed within that machine's JVM using the following command line construct:

java myappclass

Sample Java Application:

/**
 * The HelloWorldApp class implements an application that
 * simply displays "Hello World!" to the standard output.
 */
class HelloWorldApp {
        public static void main(String[] args) {
                System.out.println("Hello World!"); //Display the string.
        }
}

Sample Java Applet:

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

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