会,而且先执行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
|