会,而且先执行finally,在执行try?
—————————————————–
public class Test {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
String str=showResult();
System.out.println(str);
}
public static String showResult(){
try {
System.out.println(“1——–”);
return “hello world”;
} catch (Exception e) {
return “failure”;
}finally{
System.out.println(“2——-”);
}
}
}
——————————————————
结果是:
1——–
2——-
hello world
欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) | 黑马程序员IT技术论坛 X3.2 |