当前位置: 代码迷 >> Java面试 >> 下面这道题目,该如何处理
  详细解决方案

下面这道题目,该如何处理

热度:71   发布时间:2016-04-17 19:40:07.0
下面这道题目

Consider the following Java program segment.

import java.io.*;

public class SomeClass{

  public void x() {

  throw new RuntimeException("Exception from x");
  }
  
  public void y(){

  throw new IOException("Exception from y");
  }
}
Which of the following is true concerning the definitions for the methods x and y?



 (a) x has an illegal definition, but y has a legal definition.
 (b) x has a legal definition, but y has an illegal definition.
 (c) Both x and y have legal definitions.
 (d) Neither x nor y has a legal definition.


------解决方案--------------------
我选B
  相关解决方案