nerdexam
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)
  • A
    7% (2)
  • B
    4% (1)
  • C
    15% (4)
  • D
    74% (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.

Full 1Z0-815 Practice