首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件开发 >

在catch中施用throw,finally中的语句是否会执行

2012-07-05 
在catch中使用throw,finally中的语句是否会执行?public class Exceptiontest{?? public static void main(

在catch中使用throw,finally中的语句是否会执行?

public class Exceptiontest
{
?? public static void main(String[] args) throws Exception
?? {
??? try{
???? System.out.println("zai try中");
??? }catch(Exception e){
???? System.out.println("zai catch中");
???? throw new Exception("在catch中的throw");
??? }finally{
???? System.out.println("zai finally");
??? }
?? }
}

执行结果是:

zai try中
zai finally

说明:尽管在catch中使用throw,程序依然会执行finally中的语句

热点排行