What is a difference between checked and unchecked exception??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 3

What is a difference between checked and unchecked exception???

17th Nov 2017, 4:20 PM
Dafy siby
Dafy siby - avatar
1 Answer
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.
31st Dec 2017, 11:55 PM
Miguel Fontes
Miguel Fontes - avatar