public?class?WrongWayStopThread?extends?Thread{
public?void?run(){
System.out.println("線程正在運(yùn)行");
long?time?=?System.currentTimeMillis();
while((System.currentTimeMillis()-time)<1000){}
}
public?static?void?main(String[]?args)?{
WrongWayStopThread?wwst?=?new?WrongWayStopThread();
System.out.println("啟動(dòng)線程?");
wwst.start();
try?{
sleep(3000);
}?catch?(InterruptedException?e)?{
e.printStackTrace();
}
System.out.println("中斷線程");
wwst.interrupt();
try?{
sleep(3000);
}?catch?(InterruptedException?e)?{
e.printStackTrace();
}
System.out.println("線程結(jié)束了");
}
}

2014-12-15
自己找到錯(cuò)誤了,run方法中沒寫while循環(huán)