- class Demo
- {
- public static void func()
- {
-
- try
- {
- throw new Exception();
- System.out.println("A");
- }
- catch (Exception e)
- {
- System.out.println("B");
- }
-
- }
- public static void main(String[] args)
- {
-
- try
- {
- func();
- }
- catch (Exception e)
- {
- System.out.println("C");
- }
- System.out.println("D");
-
- }
- }
复制代码
为什么编译失败,且失败的原因是因为打印“A”的输出语句执行不到? |