下面代码的输出问题:
public class A{
public static int test(int x) {
try {
if (x == 0)
throw new Exception("x is 0");
return ++x;
} catch (Exception e) {
System.out.println("Wrong");
return 0;
} finally {
System.out.println("Finally");
}
}
public static void main(String[] args) {
System.out.println(test(0));
}
}
输出是:
Wrong
Finally
0
为什么先输出Finally而不是0?请详解?