Given:
2. class MyException extends Exception { } 3. class Action { 4. void doStuff() { } 5. }/*w w w . jav a 2 s . c o m*/ 6. public class Main extends Action { 7. public static void main(String[] args) { 8. new Main().doStuff(); 9. } 10. // insert code here 11. System.out.println(7/0); 12. } 13. }
And given the following four code fragments:
I. void doStuff() { II. void doStuff() throws MyException { III. void doStuff() throws RuntimeException { IV. void doStuff() throws ArithmeticException {
When fragments I-IV are added, independently, at line 10, which are true?
Choose all that apply.
C and D are correct.
An overriding method cannot throw checked exceptions that are broader than those thrown by the overridden method.
An overriding method can throw RuntimeException not thrown by the overridden method.