public class Test {
public static void main(String[] args) {
System.out.println(test4());
System.out.println("y = " + y);
}
public static String test4() {
String aa = "aa";
try {
aa = "bb";
return aa;
} catch (Exception e) {
e.printStackTrace();
} finally {
aa = "cc";
}
return aa;
}
********************************************************************************************************************************************************************************************
public class Test {
public static void main(String[] args) {
int y = test5();
}
public static int test5() {
int x = 1;
try {
System.out.println("A");
return ++ x;
} catch (Exception e) {
System.out.println("D");
} finally {
System.out.println("B");
++x;
}
System.out.println("C");
return x;
}
原文地址:https://www.cnblogs.com/suger-4/p/11972431.html