publicclassTestMain{publicstaticvoidmain(Stringargs[]){LoopCountThreadloopCountThread;loopCountThread=newLoopCountThread();loopCountThread.start();try{System.in.read();}catch(java.io.IOExceptione){e.printStackTrace();}loopCountThread.stop();}}classLoopCountThreadextendsThread{publicvoidrun(){intCount=0;while(true){System.out.println("running,iCount="+Count++);try{Thread.sleep(1000);}catch(InterruptedExceptione){}}}}源代码显示stop方法deprecated。并且这段代码是否有地方缺失吗
添加回答
举报
0/150
提交
取消