• 2021-04-14
    检查下面的代码: class E1 extends Exception{} class E2 extends E1{} public class Quiz6_l{ public static void f(boolean flag) throws E1,E2{ if(flag) { throw new E1(); } else { throw new E2(); } } public static void main(String[] args) { try{ f(true); } catch(E2 e2) { System.out.println("Caught E2"); }catch(E1 e1) { System.out.println("Caught El"); } } } 对上面的程序进行编译、运行,下面的叙述哪个是正确的:
  • 举一反三