Secret to Memorize 50 Elements From The Periodic Table.Click Here.

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

0 votes
asked Nov 25, 2015 by nanospeck (4,600 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,600 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.

Get help in Facebook Messenger!

2 Other people got help thru our messenger bot today!