An unchecked exception occurs in a method dosomething() Should other code be added in the dosomething() method for it to compile and execute?

An unchecked exception occurs in a method dosomething() Should other code be added in
the dosomething() method for it to compile and execute?

An unchecked exception occurs in a method dosomething() Should other code be added in
the dosomething() method for it to compile and execute?

A.
The Exception must be caught

B.
The Exception must be declared to be thrown.

C.
The Exception must be caught or declared to be thrown.

D.
No other code needs to be added.



Leave a Reply 2

Your email address will not be published. Required fields are marked *


imyrta

imyrta

Answer: D

Explanation:

The Java programming language does not require methods to catch or to specify
unchecked exceptions (RuntimeException, Error, and their subclasses).