public class Test extends Thread{
public void run() {
Thread.sleep(1000);
}
public static void main(String[] args) {
new Test().start();
}
}既然上面代码直接调用一定会抛异常;
public class Test extends Thread{
public void run() {
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
new Test().start();
}
}那么加上try-catch之后catch语句块为何又没有被执行???
Thread.sleep(1000);
不是必然抛异常吗?
qq_杀意隆_0
北七哦
半枯
随时随地看视频慕课网APP
相关分类