不会,打断是打断当前,休眠的线程。会有报错,但是不影响后面的运行。
public class ThreadDemo extends Thread{
public void run(){
System.out.println(1);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
e.printStackTrace();
}
System.out.println(2);
}
public static void main(String[] args) {
ThreadDemo threadDemo = new ThreadDemo();
threadDemo.start();
threadDemo.interrupt();
}
}