public class Threads2 implements Runnable {
public void run() {
System.out.println("run.");
throw new RuntimeException("Problem");
}
public static void main(String[] args) {
Thread t = new Thread(new Threads2());
t.start();
System.out.println("End of method.");
}
}
我预测输出为
run.
//exception
但它显示输出为,
run
exception
end of method
(或者)
run
end of method
exception
我想知道,一旦发生异常,程序就会终止,对吗?