To view an applet in the browser, following steps need to be followed:
Compile the applet you have written … the .java file so as to get the .class file.
Then, include the following code in your .html file:
<APPLET CODE="XZY.class" WIDTH=100 HEIGHT=100> </APPLET>
And then open the file using a java enabled browser.