JAVA QUESTION
A checked exception extends class Exception. What class do unchecked exceptions extend?
IgnorableException
Exception (same as for a checked exception)
RuntimeException
UncheckedException
Unchecked Exceptions extends Runtime exceptions
Explanation:
In Java there are two types of exceptions. They are:
1. Checked Exceptions: Exceptions checked at the compile time. If a method throws a checked exception, the method then must either handle the exception or must specify the exception using throw keyword.
2. Unchecked Exception: Exceptions that are not checked at the compile time. In Java exceptions under error and runtime exceptions are Unchecked exceptions. Eveything under throwable are Checked exceptions
In brief, if a client can reasonably recover from the exception then mark it as Checked. If a client cannot do anything to recover from the exception mark it as unchecked.
Get Answers For Free
Most questions answered within 1 hours.