If I create an exception class that extends Exception
, will my class be checked or unchecked? I note that the subclass of Exception
called RuntimeException
is an unchecked exception whereas all other subclasses of 'Exception' are checked exceptions.
If I create an exception class that extends RuntimeException
, can I specify that this class is checked?
1) Checked
2) No
If you extend Exception -> checked
If you extend RuntimeException -> unchecked
From documentation:
The class {@code Exception} and any subclasses that are not also * subclasses of {@link RuntimeException} are checked * exceptions