标签:col 编译错误 code except int 执行 new exception str
1 @Test
2 public void Test_Exception() {
3 try {
4 throw new ExceptionB("A");
5 } catch (ExceptionA e) {
6 System.out.println("ExceptionA"); //true
7 } catch (Exception e) {
8 System.out.println("Exception"); //false
9 } /*catch (ExceptionA e) {
10 System.out.println("ExceptionA"); //编译错误
11 }*/
12 }
类Exception_A继承Exception,类Exception_B继承Exception_A,请问执行此段代码的输出是什么?
标签:col 编译错误 code except int 执行 new exception str
原文地址:https://www.cnblogs.com/DebugTheWorld/p/9780238.html