In Java, we have checked exceptions and unchecked exceptions. Also, we have runtime exceptions. My question is - Are all runtime exceptions unchecked exceptions and all unchecked exception are runime excepions? Means can these two words be used interchangeably?
All runtime exceptions (e.g. NullPointerException) are unchecked exceptions.
Since errors (e.g. StackOverflowError) are also unchecked exceptions, not all unchecked exceptions are runtime exceptions.
The Java Language Specifications define an unchecked exception: "The unchecked exception classes are the run-time exception classes and the error classes."
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With