展开全部
举个例子吧:32313133353236313431303231363533e58685e5aeb931333335303538try {
int a = Integer.parseInt("a");
} catch (Exception e) {
// TODO: handle exception
System.out.println(e.getCause());
System.out.println(e.getClass());
System.out.println(e.getLocalizedMessage());
System.out.println(e.getMessage());
System.out.println(e.getStackTrace());
}
输出结果是:
null
class java.lang.NumberFormatException
For input string: "a"
For input string: "a"
[Ljava.lang.StackTraceElement;@1fb8ee3
=================================================
在SQLException 中可以:e.getErrorCode();