ITeye博客

Java Exception

newand · 2008-06-06 13:52 · JAVA · Markdown

Throwable(是所有Error和Exception的超类) 的一些API:

1.getCause()

2.getStackTrace() 得到 StackTraceElement

 

StackTraceElement

    |->  getFileName        得到产生异常的文件名

    |->  getLineNumber    得到异常发生的代码行

    |->  getMethodName  得到发生异常的方法

 

可以使用这些API来改变异常输出的格式。

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。