public class FinallyTest{
    static public void main(String[] args){
        System.out.println("f() return :" + f());
    }
    static public int f(){
        int i = 12;
        try{
            i += 1;
            return i;
        }finally{
            i += 3;
            System.out.println("in finally:" + i);
        }
    }
}

输出:(NotePad++)

java-代码-最佳实际_public