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

What is the difference between checked exception and unchecked exception.

an example program might help me understand this better.

10th Aug 2017, 2:37 PM
Devbrath
Devbrath - avatar
1 Answer
+ 2
checked exceptions must be handled in your code. unchecked exceptions (also called runtime exceptions) can be thrown by your program without having the compiler complaining. NullPointerException is runtime exception, it can be thrown inexpectedly. IOException, SQLException are checked exceptions so your program needs to handle those (catch or at least declare in method signature)
10th Aug 2017, 8:40 PM
Roland Sterkendries
Roland Sterkendries - avatar