Which approach ensures that the class can be compiled and run?

Given: Which approach ensures that the class can be compiled and run?

Given: Which approach ensures that the class can be compiled and run?

A.
Put the doSomething() method in the try block of a try – catch

B.
Put the doSomething() method and the doSomethingElse() method in the try block of a
try – catch

C.
Put the doSomethingElse() method in the try block of a try – catch

D.
Put the throw new Exception() statement in the try block of try – catch

Explanation:



Leave a Reply 2

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


imyrta

imyrta

Answer: D

Explanation:

Options A, B, C are wrong because the exception is not propagated outside of the doSomethingElse() method.

The only solution in this case is D.