這是說線程睡眠時必定拋出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
提交
取消