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