什么鞭炮最像枪声:请看看这个程序怎么编译不能通过 ;到底是什么问题?谢谢!

来源:百度文库 编辑:神马品牌网 时间:2024/04/29 11:13:54
class PingPong extends Thread {
private String word;
private int delay ;
public PingPong (String whatToSay,int delayTime)
{word=whatToSay;delay=delayTime;}
public void run(){
try{
for( ; ; ){
System.out.println(word+" ");
Thread.sleep(delay);
}
}catch(InterruptedException e){ return;} }
}
public static void main(String args[]){
PingPong qq= new PingPong("ping",40);//创建线程
PingPong pp= new PingPong("Pong",100);
pp.start();qq.start();//线程开始运行
}
}