123456789101112131415



Question 1: class A{
void foo() throws Exception { throw new Exception(); }
}
class SubB2 extends A {
void foo() { System.out.println("B "); }
}
class Tester {
public static void main(String[] args) {
A a = new SubB2();
a.foo();
}
}

What is the result?

1. B
2. B, followed by an Exception.
3. Compilation fails due to an error on line 9.
4. Compilation fails due to an error on line 14.