Generally if any class extends Exception
, it becomes checked exception. Runtime exception
also extends Exception. Then how is it unchecked e
Run-time exception is called unchecked exception since it's not checked during compile time. Everything under throwable except ERROR
and RuntimeException
are checked exception. Adding Runtime exception in program will decrease the clarity of program.
class Divide {
public static void main(String [] args){
int a = 10;
int b = 0;
int c = a/b; // This will throw run time exception due to unexpected value of b.
}
}
Please read this link The Java™ Tutorials - Unchecked Exceptions — The Controversy