Menu
Question Index
...

What will be the output of the following program?

import java.io.*;
class Main {
    public static void main(String[] args) throws IOException {
        Except e = new Except();
        e.disp();
        Except1 e1 = new Except1();
        e1.disp();
        Trial t = new Trial();
        t.disp();
    }
}
class Except {
    public void disp() throws EOFException, FileNotFoundException {
        System.out.println("It is a super class");
    }
}
class Except1 extends Except {
    public void disp() throws FileNotFoundException {
        System.out.println("It is a sub class named except1");
    }
}
class Trial extends Except {
    public void disp() throws IOException {
        System.out.println("It is a sub class named trial");
    }
}


It is a super class
It is a sub class named except1
It is a sub class named trial
It is a super class
It is a super class
It is a sub class named except1
It is a super class
It is a sub class named trial
Some other output
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java Throw Keyword - Java Throws Keyword Exception Handling Syntax In Java Programming

Read this topic Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App