最佳答案
Please see the following code and explain the output behavior.
public class MyFinalTest {
public int doMethod(){
try{
throw new Exception();
}
catch(Exception ex){
return 5;
}
finally{
return 10;
}
}
public static void main(String[] args) {
MyFinalTest testEx = new MyFinalTest();
int rVal = testEx.doMethod();
System.out.println("The return Val : "+rVal);
}
}
The result is the return Val : 10.
Eclipse shows a warning: finally block does not complete normally
.
What happens to the return statement in catch block ?