views:

267

answers:

0

Possible Duplicate:
In Java, does return trump finally?

In the below example,

class ex8
{
    public void show()
    {
        try
        { 
            int a=10/0;
            return;
        }
        catch(ArithmeticException e)
        {    
            System.out.println(e);
            return;
        }
        finally
        {
            System.out.println("Finally");
        }

    }

    public static void main(String[] args)
    {
        new ex8().show();
    }
}

the output is:

java.lang.ArithmeticException: / by zero
Finally

How is it that Finally gets printed in spite of return statement in catch?