赶紧动手,写了一个DEMO,恍然大悟:
public class TestFinally { public int getAddResult(int x,int y){ try{ System.out.println("before return in try section."); return x+y; }finally{ System.out.println("before return in finally section."); return x*y; } } public static void main(String[] args) { System.out.println(new TestFinally().getAddResult(10, 20)); } }上面程序的返回结果如下: