采用finally从句中的,可能会丢失异常

package thinking;
//: LostMessage.java
// How an exception can be lost
class VeryImportantException extends Exception {
    public String toString() {
       return "A very important exception!";
    }
}
class HoHumException extends Exception {
   public String toString() {
      return "A trivial exception";
   }
}
public class LostMessage {
    void f() throws VeryImportantException {
       throw new VeryImportantException();
    }

    void dispose() throws HoHumException {throw new HoHumException();}
    public static void main(String[] args) throws Exception {
    LostMessage lm = new LostMessage();
    try {
       lm.f();
    } finally {
       lm.dispose();
    }
}

} ///:~
  

VeryImportantException 被finally从句中的HoHumException的异常替代了,即出错信息丢失了。

最新文章

  1. 【Knockout.js 学习体验之旅】(2)花式捆绑
  2. 在windows系统下,在终端快速打开某个路径
  3. Class.forName("com.mysql.jdbc.Driver") ;
  4. 如何在Delphi里面查看程序的汇编代码?
  5. Python基础(二)之集合
  6. windows下socket学习(一)
  7. 限制EditText只能输入小数点后两位
  8. Unity4.5版本DLL库名字问题
  9. php单引号、双引号与数据库
  10. CoreJava_线程并发(堵塞队列):在某个目录下搜索含有某keyword的文件
  11. C#—委托分析
  12. 写自己的第二级处理器(3)——Verilog HDL行为语句
  13. 权限开发 spring security 3.0.7 序列1 数据库脚本
  14. Java EE基础之JSP
  15. 关于Java中Arrays.sort()方法TLE
  16. memcache 启动 failed to start
  17. PostGis常用函数中文介绍
  18. svn的使用技巧
  19. springboot~openfeign从此和httpClient说再见
  20. react rem

热门文章

  1. iOS多线程编程(四)------ GCD(Grand Central Dispatch)
  2. javascript判断一个变量或对象是否存在
  3. vc6.0的一些快捷键
  4. bashdb bashdebug
  5. C.Candy
  6. Windows下VMware虚拟机使用Centos,Docker方式安装openstf的小坑
  7. Configuring Your EMS Server or EMS Console Server on Windows/Linux
  8. 一步一步学Silverlight 2系列(29):使用Transform实现更炫的效果(上)
  9. docker hub下载慢解决方法 使用daocloud的mirror
  10. 黑客技术 —— Linux 命令行