Which of the following are checked exceptions?



Which of the following are checked exceptions? (Choose all that apply)

A. Exception

B. IllegalArgumentException

C. IOException

D. NullPointerException

E. NumberFormatException

F. StackOverflowError

Answer:
A and C
Explanation:

Option A is the exception base class, which is a checked exception. Options BD, and E extend RuntimeException directly or indirectly and therefore are unchecked exceptions. Option F is a throwable and not an exception, and so should not be caught or declared. 

Free Spring Boot Tutorial - 5 Hours Full Course


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

Comments