首页 > 其他 > 详细

异常类Exception(String message, Throwable cause)中的cause理解

时间:2017-10-09 15:17:07      阅读:1340      评论:0      收藏:0      [点我收藏+]

  这个在构造函数里面竟然有一个Throwable,感觉有些奇怪。

1.

  Throwable cause 这里cause要传一个Throwable的子类异常进去么?

  是引起这个异常的异常,如果这个值是空值,那么这个异常就是源头;如果这个值等于自己,那么这个异常还没被初始化。

  /**
* The throwable that caused this throwable to get thrown, or null if this
* throwable was not caused by another throwable, or if the causative
* throwable is unknown. If this field is equal to this throwable itself,
* it indicates that the cause of this throwable has not yet been
* initialized.
*
* @serial
* @since 1.4
*/

异常类Exception(String message, Throwable cause)中的cause理解

原文:http://www.cnblogs.com/juncaoit/p/7641050.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!