第一,在文本中加入如下代码即可:
//<applet code=hello.class width=200,height=300></applet>
运行调用语句:appletviewer hello.java
第二中,在hello.class的文件夹下建一个hello.html文件(文件名相同,后缀不同)
<!--hello.htm-->
<HTML>
<BODY BGCOLOR="FFFF00">
<APPLET
CODE="hello.class"
WIDTH="240"
HEIGHT="170"
ALT="很抱歉,你的浏览器不支持java applet"
ALIGN="RIGHT"
VSPACE="20">
</APPLET>
</BODY>
</HTML>
运行调用:appletviewer hello.html