package thead.start.thread_8; public class Run { public static void main(String[] args) { try { MyThread thread = new MyThread(); thread.start(); Thread.sleep(1000); thread.interrupt(); // 输出false表示当前main从未中断过 interrupted 表示当前线程是否已经是中断状态,执行后清除状态标志为false的功能 System.out.println("是否要停止1?=" + Thread.interrupted()); System.out.println("是否要停止2?=" + Thread.interrupted()); } catch (Exception exception) { System.out.println("main catch"); exception.printStackTrace(); } } }