Menu
Question Index
...

What will be the output of the following program?

public class DemoOnException
{
    public static void main(String[] args)
    {
        try
        {
            poorMethod();
            System.out.print("A");
        }
        catch (Exception exception)
        {
            System.out.print("B");
        }
        finally
        {
            System.out.print("C");
        }
        System.out.print("D");
    }
    public static void poorMethod()
    {
        throw new RuntimeException();
    }
}


ABCD
BCD
CD
BC
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