[code=java]public class Test {
public static void main(String[] args) {
System.out.println(test());
}
public static String test() {
try {
System.out.println("try block");
return test1();
} finally {
System.out.println("finally block");
}
}
public static String test1() {
System.out.println("return statement");
return "after return";
}
} [/code]
经过运行,结果是:
try block
return statement
finally block
after return
为什么finally block会在after return之前出现呢,
|