Why runtime exception is unchecked exception?

Viewed 9137

Generally if any class extends Exception , it becomes checked exception. Runtime exception also extends Exception. Then how is it unchecked exception?

Is it like they have a custom check in compiler for this special case?

EDIT : I have proper idea about checked v/s unchecked exception and their pros & cos etc. I don't accept differences between them in answer.

5 Answers

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

Related