The exception classes which extend Error or RuntimeException are unchecked exceptions. The
Java compiler doesn't force us to tackle these exceptions. For example,
class ExceptionTest{
public static void main(
String[] sid){
throw new Exception();
}
}
//The above code won't compile, as we don't declare the exception in the method definition.
// But the following code would compile
class ExceptionTest{
public static void main(String[] sid){
throw new Error();
// or throw new RuntimeException();
}
}
// e.g. of checked exceptions-IOException etc.
// e.g. of unchecked exceptions-ClassCastExeption etc.