2019独角兽企业重金招聘Python工程师标准>>>
public class Test {
public static int test1() {
int x = 1;
try {
return x;
} finally {
++x;
}
}
public static int test2() {
int x = 1;
try {
return x;
} finally {
return ++x;
}
}
public static void main(String[] args) {
System.out.println(Test.test1());//输出1
System.out.println(Test.test2());//输出2
}
}