I don't get why is the statement in finally block being executed despite using return statement in try block. The return statement, as i know, returns the execution to the main.
If am using return in try block that means execution of try ends at that point and control goes into the main. Then why statement in finally is executed?
class a
{
public static void main(String arr[])
{
try
{
System.out.println("hello1");
return;
}
finally
{
System.out.println("hello2");
}
}
}