Undoubtedly, one of the most popular applications of using Java is through embedding applets in HTML/XHTML pages. An applet, in general, is a small program which will run automatically when downloaded into the browser. Java applets are applet programs written in Java. Throughout this chapter, the word applet refers to a Java applet.
Let’s convert the first Java program HelloWorld.java into an applet. Generally you need to perform the following tasks when creating any applet applications:
Create a Java program to generate the applet application.
Compile the source code files into bytecode or class.
Create an HTML/XHTML page and use the applet element <applet> to call ...