illigalAccess exception is an example of unchecked exception
Example 1: Can we use catch statement for checked exceptions
If there is no chance of raising an exception in our code then we can’t
declare catch block for handling checked exceptions. This raises compile time
error if we try to handle checked exceptions when there is no possibility
of causing exception.
Example 2: how to handle checked exceptions in java
I would either handle or declare. I Declare using THROWS keyword or handle by
using TRY&CATCH block. If I will use it again I would handle it. If it will
occur only once than I would use THROWS keyword