这是说线程睡眠时必定抛出InterruptedException异常?下面的代码为何不是输出true?public class Test extends Thread{
public void run() {
try {
Thread.sleep(1000);
System.out.println(Thread.interrupted());
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new Test().start();
}
}
添加回答
举报
0/150
提交
取消