Which of the following Throwable types is it recommended not to catch in a Java application?



Which of the following Throwable types is it recommended not to catch in a Java application?

A. Error

B. CheckedException

C. Exception

D. RuntimeException

Answer:

A. Error

Explanation:

While Exception and RuntimeException are commonly caught in Java applications, it is recommended Error not be caught. 

An Error often indicates a failure of the JVM which cannot be recovered from. For this reason, Option A is correct, and Options C and D are incorrect. 

Option B is not a class defined in the Java API; therefore, it is also incorrect.

Free Spring Boot Tutorial - 5 Hours Full Course


Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course

Comments