public static void main(String[] args) { Thread.currentThread().setUncaughtExceptionHandler(new UnCaughtExceptionHandler());
int a = 5 / 0; System.out.println("normal over!"); }}执行结果Thread[main,5,main] 异常:java.lang.ArithmeticException: / by zero由上可以看出,与catch不同的是,异常处理器处理异常后,程序并不会继续执行,所以也不会正常结束。本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-03/129512.htm