回复 1# 的帖子
class test
{
public test()
{
work w=new work();
w.start();
}
public static void main(String[] args)
{
test t=new test();
}
}
class work extends Thread
{
public void run()
{
System.out.println("线程正在运行!!");
this.interrupt();
if(isInterrupted()){
System.out.println("线程关闭了!!");}
else
System.out.println("为何还能显示,出问题了!!");
}
}
我加了个判断, 测试当前线程是否已经中断。返回应该也是被中断了!