The code below will throw a RuntimeException which will be caught by the first catch block that handles the RuntimeException. Then
why is it that the second catch block is attempting to handle the RuntimeException. Is it because a RuntimeException and an ArithmeticException are both unchecked exception?.
public class Tester {
public static void main(String[] args) {
try {
throw new RuntimeException();
} catch (RuntimeException e) {
System.out.println("RuntimeException");
} catch (ArithmeticException e) {
System.out.println("ArithmeticException");
} catch (Exception e) {
System.out.println("Exception");
}
}
}