What lines will the compilation error occur in:

class MyException1 extends Exception { }             // 1
class MyException2 extends RuntimeException { }      // 2
class A {
    void m1() { throw new MyException1(); }          // 3
    void m2() { throw new MyException2(); }          // 4
}
Explanation
MyException1 exception is checked, therefore it has to be handled by an m1() method.

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback