class FinallyTest { public int mothodA() { try { return 10; }finally { return 20; } } public static void main(String[] args) { FinallyTest ft=new FinallyTest(); int x= ft.mothodA(); System.out.println("the value of x is: "+x); } } 運行上邊的代碼,我們發(fā)現(xiàn)得到的返回值是finally區(qū)段中的20,而不是try區(qū)段中的10。