how to identify checked and unchecked exceptions in java code example

Example: how to know if certain exception is checked or unchecked

1) Look at the hierarchy, if that exception extends RuntimeException then 
it is an UNCHECKED exception
if that exception extends Exception, Throwable or 
any other Checked Exception, then it is CHECKED exception.
2) Throw it, if it compiles, it is an UNCHECKED exception, 
if not it is a CHECKED exception.
throw new SomeException();

Tags:

Misc Example