Menu
Question Index
...

What will be the output of the following program?

public class BlockFinal
{
    public static void main(String[] a)
    {
        try
        {
            int i = 10 / 0;
        }
        catch (Exception ex)
        {
            System.out.println("1st catch Block");
        }
        finally
        {
            System.out.println("1st finally block");
        }
        try
        {
            int i = 10 / 10;
        }
        catch (Exception ex)
        {
            System.out.println("2nd catch Block");
        }
        finally
        {
            System.out.println("2nd finally block");
        }
    }
}


1st finally block
2nd finally block
1st catch Block
2nd catch Block
1st catch Block
1st finally block
2nd catch Block
2nd finally block
1st catch Block
1st finally block
2nd finally block
Compilation Error or Runtime Error

Doubts

Problems

Topic: Exception Handling Syntax In Java Programming

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App