public class TestHello implements Runnable {
private int num=10;
public void run(){
for(int i=0;i<50;i++){
if (num >0)
Thread.sleep(1000);
System.out.println(num--);
}
}
public static void main(String[] args) {
TestHello t=new TestHello();
Thread h =new Thread(t);
Thread e=new Thread(t);
h.start();
e.start();
}
}
帮我看下这个代码哪里出错了呢?看了好久也没打到错误... |
|