Get 50% Discount on Our Udemy Course to Memorize the Periodic Table in 30 minutes Click Here. COUPON CODE: ALCHEMY

What is the difference between Checked and Unchecked Exceptions in Java? Trick to remember.

0 votes
359 views
asked Nov 25, 2015 by nanospeck (4,880 points)
What is an easy way to remember the difference between checked and unchecked exceptions?

1 Answer

0 votes
answered Nov 25, 2015 by nanospeck (4,880 points)

In java Exception is an abnormal condition in code.
Checked exception in Java is something that is done during compile time.
Unchecked exception is an exception that extends RuntimeException and it occurs only while the program is running.

It's a bit confusing to remember both, but there is a simple trick to do this. 

The trick is to observe for the pattern 'UN'.

'UN'CHECKED exception extends R'UN'timeException

If you keep this pattern in mind you'll never get confused with checked and unchecked exceptions again.

Related questions

...