Java FAQ:メソッドをオーバライドするときthrows節の例外を増やせない?

Java FAQ:S011 Q-08

throws 節自体、挙動が良く分かっていない…

class C2008042101 {
    void foo(int x) {
        System.out.println("C2008042101: " + x);
    }
}

class C2008042102 extends C2008042101 {
    C2008042102() {
        foo(1);
    }

    void foo(int x) throws ArithmeticException {
        System.out.println("C2008042102: " + 10 / x);
    }
}

public class C2008042100 {
    public static void main(String[] args) {
        new C2008042102();
    }
}

で、

C2008042102: 10
class C2008042111 {
    void foo(int x) throws ArithmeticException {
        System.out.println("C2008042111: " + 10 / x);
    }
}

class C2008042112 extends C2008042111 {
    C2008042112() {
        foo(1);
    }

    void foo(int x) {
        System.out.println("C2008042112: " + x);
    }
}

public class C2008042110 {
    public static void main(String[] args) {
        new C2008042112();
    }
}

で、

C2008042112: 1
  • try catch しなくても、なぜ OK?
  • 例外を増やせない状況を再現するコード作れなかった…