When it comes to compiling your source code, it is important to understand the difference between checked and unchecked exceptions. All exceptions are classes that are derived from the Throwable class. Memorizing the class hierarchy is the key to determining whether an exception will be a checked or an unchecked exception. There are two subclasses of the Throwable class, Error and Exception. Error and all of its subclasses down the hierarchy are all unchecked exceptions. Now here is where it gets strange ... all subclasses of Exception are checked exceptions except for RuntimeException and all of its subclasses. RuntimeException and all of its subclasses down the hierarchy are unchecked exceptions.
As the Java compiler is compiling your source code, any statements that invoke methods or constructors that throw unchecked exceptions are given the green light and not required to be enclosed in a try block or specified in the throws list.
Any statements – in your source code – that invoke methods or constructors that throw checked exceptions are stopped at the red light and checked to make sure that they are enclosed in a try block or specified in the throws list.
I haven't gone over how to use the throws keyword just yet, so don't worry about that.
On this page of the site you can watch the video online Learn Java Programming - Checked and Unchecked Exceptions Tutorial with a duration of hours minute second in good quality, which was uploaded by the user Daniel Ross 14 September 2015, share the link with friends and acquaintances, this video has already been watched 2,165 times on youtube and it was liked by 15 viewers. Enjoy your viewing!