finally抛异常
2016-05-12 15:18
375 查看
finally里面抛异常,话不多说,上代码和结果;
public class FinallyExcepTest { private static void test01(int a){ try { System.out.println("hello"); }finally { System.out.println("1--"); int b = 1/a; System.out.println(b); System.out.println("2--"); } } public static void main(String[] args){ test01(0); } } hello 1-- Exception in thread "main" java.lang.ArithmeticException: / by zero at me.base.knowledge.exception.FinallyExcepTest.test01(FinallyExcepTest.java:18) at me.base.knowledge.exception.FinallyExcepTest.main(FinallyExcepTest.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
相关文章推荐
- Android混淆打包配置总结
- 我也有微信朋友圈了 Android实现
- appium android——利用testng和maven并行执行用例
- HDU 1495 非常可乐
- (改)python 仿ab网站压力测试
- 初装DELL R720的一些记录
- 浅谈__declspec(selectany)该何时用
- Android快速开发框架
- iOS开发中,应用内直接跳转到Appstore(适合版本强制升级和跳转appstore评分)
- 基本的excel表格开发
- Scala override
- java程序故障排查脚本之——CPU占用高
- Prefix.pch文件的作用
- iOS 使用afnetworking3.0 时 真机编译出现问题: Undefined symbols for architecture armv7
- 【第七章】 对JDBC的支持 之 7.4 Spring提供的其它帮助 ——跟我学spring3
- cnblogs.com的用户体验
- 移动端触屏滑动,JS事件
- 身份证号码验证正则表达式
- Mac上小巧实用的GIF格式录屏软件 LICEcap
- C# 调用C++ DLL 的类型转换