Menu
Topics Index
...
`

Finally Block


If you need explanation Read this topic

If you need Answer Take test on this topic

Finally Block
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");
        }
    }
}

A. 1st finally block
2nd finally block
B. 1st catch Block
2nd catch Block
C. 1st catch Block
1st finally block
2nd catch Block
2nd finally block
D. 1st catch Block
1st finally block
2nd finally block
E. Compilation Error or Runtime Error
Topic: Exception Handling Syntax In Java Programming

If you need explanation Read this topic

If you need Answer Take test on this topic

User comments below. All of them might not be correct.

Ans d..1st exception wl raise so catch n fnly wl execute 2nd tm exctption wont raise so finaly only execute

Posted by Uday Kumar    2014-08-07 03:44:46


answer is d there is exception in first block and no exce[ption in second block

Posted by Shiva Goud    2014-08-07 06:26:09


Congratulations Uday Kumar. You are this dose winner. We will send you the link using which you can claim your recharge.

Posted by Merit Campus    2014-08-08 04:32:10


© meritcampus 2019

All Rights Reserved.

Open In App