| 复制代码class InterruptDemo
{
        public static void main(String[] args)
        {
                StopThread st=new StopThread();
                Thread t1=new Thread(st);
                Thread t2=new Thread(st);
                t1.start();
                t2.start();
                t1.interrupt();
                t2.interrupt();
 
        }
}
class StopThread implements Runnable
{
        private boolean flag=true;
        public synchronized void run()
 
        {
                while(flag)
                {
                        try
                        {
                                wait();
                        }
                        catch(InterruptedException e)
                        {
                                System.out.println(Thread.currentThread().getName()+"...Exception");                               
                                 flag=false;[color=Red]Thread-0被强制清除冻结状态后,打印了Thread-0...Exception,然后把标记改为了false,在往下打印了Thread-0...run。至此因为标记被改变,程序就结束了。所以没有后来的了[/color]
                        }
                        System.out.println(Thread.currentThread().getName()+"...run");
                }
        }
}
 |