When a java program starts, a thread runs immediately, which is usually called the main thread of the program. The importance of the main thread lies in two aspects: it is the thread that produces other sub threads. § usually it has to be executed last because it performs various closing actions
import java.awt.*;
import java.applet.Applet;
public class Javase_64 extends Applet //定义主类
{
private String v_name; //定义变量用于接收HTML文件传入的参数
private int v_age;
public void init() //初始化方法
{
v_name=getParameter("vname"); //接收HTML文件传入的参数
v_age=Integer.parseInt(getParameter("age")); //接收参数并将参数转换为整型
}
public void paint(Graphics g)
{
g.drawString("姓名:"+ v_name+" ;年龄:"+ v_age,10,20);
//System.out.println("计算机系");
}
}
<Javase_64 .html>
<html>
<applet code="Javase_64 .class" height=150 width=300>
<Param name=vname value="user">
<Param name=age value=24>
</applet>
</html>