try catch finally 理解
来源:互联网 发布:买玩具枪被判无期知乎 编辑:程序博客网 时间:2024/05/29 12:25
1.finally 的使用,不一定要catch语句
2.finally 一定会执行。
3.try catch finally 返回int类型 时,如果try catch finally 都没有return,则需要在外部返回一个return
4.try catch finally 返回int类型 时,如果try catch 没有return,finally中有return,则外部不需要返回一个return。而且不管try catch语句中有return,只会返回finally return值
public static int testFinally(){ try { int a = 2/0;// return 2; }catch (Exception e){ System.out.println(e.getMessage()); return 4; }finally {// return 0; System.out.println("finally"); return 0; }// return 1; }
0 0
- try catch finally 理解
- javascript:理解try...catch...finally
- 深入理解java中的try-catch-finally
- JAVA try、catch、finally执行理解
- try..catch..finally
- try-catch-finally
- Try-catch-finally机制
- 关于try-catch-finally
- C# try catch finally
- try...catch...finally
- try catch finally用法
- Try ---Catch----Finally
- try...catch... finally
- try....catch...finally 妙用
- try{} catch(){}finally{}执行
- Try Catch Finally
- try-catch-finally
- C# try, catch ,finally
- teamviewer 工作原理
- 用正则判断数组是否全是数字组成
- 查找 oracle 数据库中包含某一字段的表名
- 简易版主题切换功能的实现
- MySQL事务隔离级别详解
- try catch finally 理解
- CxImage使用介绍
- C# xml某节点下内容全部清空
- 监听uitableview 数据加载完成重新设置tableview的高度
- codeforces #397 problemE 解题报告 补题
- 图解Linux命令之--hdparm命令
- 2017-02-17
- chrome浏览器的跨域设置——包括版本49前后两种设置
- 线程join()方法join的含义