class A {
protected int method1 (int a, int b) {
return 0;
}
}
public static int demo5() {
try {
return printX();
}
finally {
System.out.println("finally trumps return... sort of");
}
}
public static int printX() {
System.out.println("X");
return 0;
}
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";
}
10题 | 被引用0次