public class HelloWorld{
static int a;
public static void main(String []args){
System.out.println("Hello World");
HelloWorld h =new HelloWorld();
a = h.foo();
System.out.println(a);
}
int foo()
{
try{
throw new Exception();
}
catch(Exception e){
System.out.println("catch");
return 9;
}
finally{System.out.println(a);return 10;}
} }
When I ran the above code output was:
Hello World
catch
0
10
Now i have a doubt that does the return in catch is executed first or the finally block executed first??