Given the following code

public class OverrideThrowsTest {
    public static void main(String[] args)
        // 1
        A a = new A();
        A ab = new B();
        B b = new B();

class A {
    public void method() throws IOException {}

class B extends A {
    public void method() throws FileNotFoundException {}
Select all the answers, for which, if placed into line 1, code will compile.
FileNotFoundException extends IOException,
IOException extends Exception. Such throws that would cover all the possible exceptions should be declared - IOException and Exception in this case.
Java Quiz
Start Quiz

or Read more about Java Quiz

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback