public class TestMain {
public static void main (String args[]) {
LoopCountThread loopCountThread;
loopCountThread = new LoopCountThread();
loopCountThread.start();
try { System.in.read();
} catch(java.io.IOException e) {
e.printStackTrace();
}
loopCountThread.stop();}
}
class LoopCountThread extends Thread {
public void run() {
int Count = 0;
while (true)
{
System.out.println("running, iCount = " + Count++);
try {Thread.sleep(1000);}
catch(InterruptedException e){}
}
}
}
源代码 显示stop方法 deprecated。并且这段代码是否有地方缺失吗
楼上的on没用到循环判断条件上,更正一下~