If I write RunTimeException in catch block then why it is not handled.
class main{
public static void main(String cs[]){
try{
int a = 10/0;
}
catch(RunTimeException e){
System.out.println("exception caught");
}
}
}
My question is why there is an error if I write RunTimeException and not in case if I write the subclass of RunTimeException i.e ArithmaticException and super class Exception.
error is
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
RunTimeException cannot be resolved to a type