}
运行结果是:
before exception
catcher
finally
value = 1
catch中有return,finally中没有return,通过debug代码可知,先执行finally中的代码,然后再执行catcher中return 1。作者: ゞ神说 时间: 2015-10-31 19:57
public class FinallyReturnTest {
public static void main(String[] args) {
System.out.print("value = " + testMethod());
}
public static int testMethod() {
try {
System.out.println("before exception");
int y = 1;
int x = y/0;
System.out.println("after exception");