try catch finally 与reture
public class Test {
public static int testFinally() {
try {
return 1;
} catch (Exception ex) {
return 2;
} finally {
System.out.println("execute finally");
}
}
public static void main(String[] args) {
int result = testFinally();
System.out.println(result);
}
}execute finally
1Last updated