星空网 > 软件开发 > Java

finally关键字

final:禁止多态开关~
修饰变量:变量不能被改变
修饰类:类不能被继承
修饰方法:方法不能被重写

finally:用在异常处理的最后一个语句块
无论是否产生异常都要被执行~~~

 

Java代码 
 1   public final class FinallyTest {  2     public static void main(String[] args) {  3        try {  4         throw new NullPointerException();  5        } catch (NullPointerException e) {  6         System.out.println("程序抛出了异常");  7        } finally {  8         System.out.println("执行了finally语句块");  9         } 10     } 11   } 

 




原标题:finally关键字

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

越南海运港口:https://www.goluckyvip.com/tag/92073.html
中国海运到新西兰:https://www.goluckyvip.com/tag/92074.html
新西兰海运到中国:https://www.goluckyvip.com/tag/92075.html
中国到新西兰海运:https://www.goluckyvip.com/tag/92076.html
海运去西班牙:https://www.goluckyvip.com/tag/92077.html
克罗地亚国际海运:https://www.goluckyvip.com/tag/92078.html
深圳到西安自驾路线攻略 深圳到西安自驾最佳路线:https://www.vstour.cn/a/411228.html
松花蛋是哪里的特产松花蛋的产地:https://www.vstour.cn/a/411229.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流