Home / Questions / Consider the following try .... catch block:
Explanatory Question

Consider the following try .... catch block:

👁 20 Views
📘 Detailed Answer
🕒 Easy to Read
Read the answer carefully and go through the related questions on the right side to improve your understanding of this topic.

Answer with Explanation


class TryCatch
{
    public static void main(String args[])
    {
        try
        {
            double x = 0.0;
            throw new Exception("Thrown");
        }
        catch (Exception e)
        {
            System.out.print("Exception caught");
            return;
        }
        finally
        {
            System.out.println("finally");
        }
    }
}

Output:


Exception caughtfinally