Menu
Question Index
...

What will be the output of the following program?

import java.io.*;


public class Exception4
{
    void m() throws IOException {
        throw new java.io.IOException("device error");
    }
    void n() {
        m();
    }
    void p() {
        try {
            n();
        } catch (Exception e) {
            System.out.println("exception handled");
        }
    }
    public static void main(String args[]) {
        Exception4 obj = new Exception4();
        obj.p();
        System.out.println("normal flow");
    }
}


exception handled
normal flow
device error
exception handled
normal flow
device error
normal flow
Compilation Error or Runtime Error

Doubts

Problems

Topic: Java Throw Keyword - Java Throws Keyword

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App