多做题,通过考试没问题!

Java认证考试

睦霖题库>其他计算机考试>Java认证考试

What is wrong with the following code?()   class MyException extends Exception {}   public class Qb4ab {   public void foo() {  try {  bar();  } finally {  baz();   } catch (MyException e) {}  }   public void bar() throws MyException {   throw new MyException();  }   public void baz() throws RuntimeException {   throw new RuntimeException();   }   }  

  • A、Since the method foo() does not catch the exception generated by the method baz(), it must      declare the RuntimeException in its throws clause.
  • B、A try block cannot be followed by both a catch and a finally block.
  • C、An empty catch block is not allowed.
  • D、A catch block cannot follow a finally block.
  • E、A finally block must always follow one or more catch blocks.
正确答案:D
答案解析:
进入题库查看解析

微信扫一扫手机做题