try和finally都有return

执行以下代码
public static String ddfd(){
try {
System.out.println("try");
return "8888";
} catch (Exception e){
System.out.println("catch");
}finally {
System.out.println("finally");
return "9999";
}
}

main函数运行
public static void main(String[] args) {
System.err.println(ddfd());
}
结果===================================

try
finally
9999

posted @ 2020-07-28 16:41  青烟雀语  阅读(184)  评论(0)    收藏  举报