public Geezer { public void (String args){
.out.prln("预备,开始!");
Corrie c = Corrie; //只有个山洞,所以生存个例子后传给多个Player.
Player("Axman","001",c).start;
Player("Sager","002",c).start;
Player("Pentium4","003",c).start;
}
}
这个类暂时没有什么多说,它是个Main角色.
public Player extends Thread{ private final String name;
private final String number;
private final Corrie corrie;
public Player(String name,String number,Corrie corrie) {
this.name = name;
this.number = number;
this.corrie = corrie;
}
public void run{
while(true){
this.corrie.o(this.name,this.number);
}
}
}
在这里,我们把成员字段都设成final,为了介绍说明个Player旦构造,他名字和牌号就不能改变,简单说在游戏中,我,Sager,Pentium4 3个人不会自己偷偷把自己牌号换了,也不会偷偷地去钻别山洞,如果这个游戏旦发生,那么不在我们玩家.
="xspace-totlerecord">3="xspace-totlepages">1/3="xspace-current">123>
最新评论