`
aak86aak
  • 浏览: 25724 次
社区版块
存档分类
最新评论

注意异常丢失的情况-仰望者-iteye技术网站

 
阅读更多

注意异常丢失的情况-仰望者-iteye技术网站
2011年09月01日
  package com.lwf.thinking.eight; import java.sql.SQLException; public class UserDefineException { public static void main(String[] args) throws Exception{ UserDefineException u = new UserDefineException(); try { u.throwException(); } finally{ u.catchException(); } } public static void catchException() throws EusException{ throw new EusException(); } public static void throwException() throws EusBusiException { throw new EusBusiException(); } } 
  对应的异常类EusException和EusBusiException都只是简单的继承Exception类。
  输出结果:
  Exception in thread "main" com.lwf.thinking.eight.EusException
  at com.lwf.thinking.eight.UserDefineException.catchEx ception(UserDefineException.java:17)
  at com.lwf.thinking.eight.UserDefineException.main(Us erDefineException.java:12)
  从结果可以发现EusBusiException异常丢失了。这是JAVA的一个重要的缺陷。。 
  
  
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics