标签为 [线程] 的文章

处理线程中的unchecked exception(RuntimeException)

如果使用常规的try…catch来对从线程中抛出的异常进行处理,运行下面的代码会得到java.lang.RuntimeException的提示,所以可以看见使用try..catch无法捕获从线程中抛出的异常。 123456789101112131415161718192021 package Exception; public class ExceptionThread extends Thread{public void run(){throw new RuntimeException();} public static void main(String[] args){ExceptionThread thread = new ExceptionThread();try{thread.start();}catc ......