try catch finally
来源:互联网 发布:刚开的淘宝店没生意怎么办 编辑:程序博客网 时间:2024/06/05 18:52
class Age { public void setAge(int age) throws Exception{ if (age < 12 && age > 0){ System.out.println("This is a child"); }else if(age >= 18){ System.out.println("This is a adult"); }else if(age >=12 && age < 18){ System.out.println("This is a youth"); }else{ Exception e = new Exception("The age can't be negative number"); throw e; } }}public class TestDemo { public static void main(String args[]){ Age a = new Age(); try{ a.setAge(-1); } catch(Exception e){ System.out.println(e); } finally { System.out.println("The End"); } }}
0 0
- 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
- try catch finally
- try catch finally
- try-catch-finally
- try...catch...finally
- Android中关于线性布局基线对齐
- Android【封装】多线程下载以及断点续传
- 基于BP网络解决异或问题
- 开源大数据查询分析引擎现状
- SQL中as的用法
- try catch finally
- 数据结构学习整理
- JAVA:监控按钮的两种方法
- Slidr
- mybatis插入数据主键自动增长处理
- [Java][activiti]同步或者重构activiti identify用户数据的方法
- dpkg:处理 xxx (--configure)时出错解决办法
- Android加载动画系列——WaterBottleLoading
- 使用Dagger 2依赖注入 - DI介绍