+ 3
What is a difference between checked and unchecked exception???
3 Réponses
0
As people said, checked exceptions are exceptions from the Exception Class family. It is expected that the developer catch those exceptions somewhere on the applicatiom and execute some kind of recovery or cleanup, or add them to the method signature, explicitly saying that those are thrown and must be intercepted somewhere else. Checked exceptions are verified at Compile Time.
Unchecked exceptions, of the RuntimeException family doesn't are free of those requirements. There's no need to add those to a method signature if they weren't intercepted.
I use the following rule when designing exceptions: if the exception represents an error from which the application can recover, it is an Checked Exception. The other way around, a runtime exception.