When the checked exceptions are checked? code example

Example 1: What are checked Exceptions

1) All the subclasses of Throwable class except error,Runtime Exception and 
its subclasses are checked exceptions.
2) Checked exception should be thrown with keyword throws or should be provided 
try catch block, else the program would not compile. We do get compilation 
error.
Examples :
1) IOException,
2) SQlException,
3) FileNotFoundException,
4) InvocationTargetException,
5) CloneNotSupportedException
6) ClassNotFoundException
7) InstantiationException

Example 2: what do you do with checked exception

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

Tags:

Misc Example