finally and return
- by abson
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?