DormitoryHead d1 = new DormitoryHead("a");
DormitoryHead d2 = new DormitoryHead("b");
DormitoryHead d3 = new DormitoryHead("c");
d1.start();
d2.start();
d3.start();
}
} 作者: 秦久启 时间: 2013-5-26 18:59
SOAR 发表于 2013-5-26 18:47
public class DormitoryHead extends Thread{
private String dorName;//宿舍名
public DormitoryHead ...
你这个写的感觉有问题啊!和题目的意思不符合,下面是我刚刚写的,不知道对不对!不过还是要谢谢你。public class Demo
{
public static void main(String args[])
{
Person p1 = new Person();
Thread t1 = new Thread(p1,"a寝室");
Thread t2 = new Thread(p1,"b寝室");
Thread t3 = new Thread(p1,"c寝室");
t1.start();
t2.start();
t3.start();