- 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.print("c");
- }
- System.out.print("d");
- }
- }
复制代码 上面的程序会编译失败,因为打印"a"输出的语句执行不到
为什么这句话System.out.println("a");执行不到程序就会编译失败呢? |