怎样才有生活情趣:请看看这个程序怎么编译不能通过 ;到底是什么问题?谢谢!

来源:百度文库 编辑:高校问答 时间:2024/05/13 04:08:33
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();//线程开始运行
}
}