throw new IOException("Exception from y"); } } Which of the following is true concerning the definitions for the methods x and y?
(a) Neither x nor y has a legal definition. (b) Both x and y have legal definitions. (c) x has an illegal definition, but y has a legal definition. (d) x has a legal definition, but y has an illegal definition.
不会做……大侠帮忙~!谢谢~! 我只知道 public void y(){
throw new IOException("Exception from y"); } 这是错的 我不知道洋文 嗯嗯,答案是x是合法的,y是不合法的,为什么呀? 选D,RuntimeException不需要异常声明,IOException需要 所以y应该声明为public void y() throws IOException 我选C,不知对错,请高手指点! 答案是D,因为x抛的是runtime的exception,改异常不catch也是可以滴