Skip to content
Quiz · Exceptions · lesson 3 of 12

Quiz — the order of catch blocks

What happens when this program is compiled and run?

JAVA
public class Main {
    public static void main(String[] args) {
        int d = 0;
        try {
            System.out.println(10 / d);
        } catch (Exception e) {
            System.out.println("error");
        } catch (ArithmeticException e) {
            System.out.println("zero");
        }
    }
}