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); } } 运行上边的代码,我们发现得到的返回值是finally区段中的20,而不是try区段中的10。