I have been reading a book named “Teach Yourself Java in 21 days” by Laura Lemay.I guess the book is a bit old and has been written in early days of java.It describes about making applets as below.
import java.awt.Graphics;
import java.awt.Font;
import java.awt.Color;
public class HelloAgainApplet extends java.applet.Applet {
Font f = new Font("TimesRoman", Font.BOLD, 36);
public void paint(Graphics g) {
g.setFont(f);
g.setColor(Color.red);
g.drawString("Hello again!", 5, 50);
}
}
This applet overrides paint(), one of the major methods described in the previous section. Because the applet doesn’t actually do much (all it does is print a couple of words to the screen), and there’s not really anything to initialize, you don’t need a start() or a stop() or an init() method.
The HTML is as follows:
<HTML>
<HEAD>
<TITLE>Another Applet</TITLE>
</HEAD>
<BODY>
<P>My second Java applet says:
<APPLET CODE="HelloAgainApplet.class" WIDTH=200 HEIGHT=50>
</APPLET>
</BODY>
</HTML>
I have done the same to practice it, but my browser gives an error as below. Why is that?

1) Put your html and class file in same folder.
2) Your html file should look like this:
That should fix the problem.