Oracle
1Z0-815 · Question #3
Given: and omitting the throws FooException clause results in a compilation error. Which statement is true about FooException?
The correct answer is D. The body of foo can throw FooException or one of its subclasses. https://stackoverflow.com/questions/47871728/throwing-a-parent-class-exception-force-to- throw- its-sub-class-exception-event-t
Handling Exceptions
Question
Given:
and omitting the throws FooException clause results in a compilation error. Which statement is true about FooException?
Options
- AFooException is a subclass of RuntimeError.
- BFooException is unchecked.
- CThe body of foo can only throw FooException.
- DThe body of foo can throw FooException or one of its subclasses.
How the community answered
(27 responses)- A7% (2)
- B4% (1)
- C15% (4)
- D74% (20)
Explanation
https://stackoverflow.com/questions/47871728/throwing-a-parent-class-exception-force-to- throw- its-sub-class-exception-event-t
Topics
#checked exceptions#throws clause#exception hierarchy#subclass
Community Discussion
No community discussion yet for this question.