Given:
3. class SubException extends Exception { } 4. class SubSubException extends SubException { } 5. 6. public class Main { void doStuff() throws SubException { } } 7. 8. class Main2 extends Main { void doStuff() throws SubSubException { } } 9. 10. class Main3 extends Main { void doStuff() throws Exception { } } 11./*from w ww. java 2 s.co m*/ 12. class Main4 extends Main { void doStuff(int x) throws Exception { } } 13. 14. class Main5 extends Main { void doStuff() { } }
What is the result? (Choose all that apply.)
C is correct.
An overriding method cannot throw a broader exception than the method it's overriding.
Class Main4's method is an overload, not an override.