次のコードを見て、出力の動作を説明してください。
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);
}
}
結果は Val : 10 を返します。
Eclipse に警告が表示されます: finally block does not complete normally
.
catch ブロックの return ステートメントはどうなりますか?