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 MyExce

题目

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
如果没有搜索结果,请直接 联系老师 获取答案。
相似问题和答案

第1题:

—I am sorry to trouble you, sir.—________

A. My pleasure.

B. What ‟s wrong with you?

C. What seems to be the problem?

D. It doesn ‟t matter.


参考答案:C

第2题:

45.1 really want to know_________

A. what is wrong with my brother

B. how will he go to Beijing tomorrow

C.if had he bought that car

D. where did he go yesterday


正确答案:A
45.A【解析】句意:我真的想知道我弟弟怎么了。动词know后跟宾语从句。宾语从句要用陈述语序, B、C、D选项都不对,故选A.

第3题:

See what you’ve done ! Don’t you have a ______ of right or wrong ?

A.feeling

B.sense

C.thought

D.knowledge


正确答案: B

第4题:

-Your request for compensation made me surprised. What happened -()

A、It’s true.

B、It’s because of the quality.

C、There must be something wrong.


参考答案:B

第5题:

-What are you going to do tomorrow morning?

-I saw a film with my son.

A. Right

B. Wrong


参考答案:B

第6题:

Rose: Hi, Lisa. What's wrong with you?______.

Lisa: No, I don't. I've got the flu.


正确答案:F

第7题:

-What time will the next train leave?

-At 8. 19.

A. Right

B. Wrong


参考答案:A

第8题:

______ the toy ________ and see if you can find what's wrong with it.

A. Separate ⋯apart

B. Cut ⋯into pieces

C. Take ⋯.apart

D. Tell ⋯apart


参考答案:C

第9题:

-What’s your job?

-I’m a nurse.

A. Right

B. Wrong


参考答案:A

第10题:

Linda, what’s wrong with your grandmother?().

A、 She is not retired

B、 She hurt her leg.

C、 She got a new house.


参考答案:B

更多相关问题