java source code doubt
- by abson
this compiles
class ex1
{
public int show()
{
try
{ int a=10/10; return 10;}
catch(ArithmeticException e)
{ System.out.println(e); }
finally
{ System.out.println("Finally");}
System.out.println("hello");
return 20;
}
}
on the other hand this doesn't
class ex15
{
public int show()
{
try
{ int a=10/0; return 10;}
catch(ArithmeticException e)
{ System.out.println(e); }
finally
{ System.out.println("Finally"); return 40;}
System.out.println("hello");
return 20;
}
}
why is it so?