打印异常的堆栈跟踪
public class Main { public static void main(String[] args) { try { m1();/** 来 自 N o w J a v a . c o m - 时 代 Java**/ } catch(MyException e) { e.printStackTrace(); // Print the stack trace } } public static void m1() throws MyException { m2(); } /** 来 自 时 代 J a v a - nowjava.com **/ public static void m2() throws MyException { throw new MyException("Some error has occurred."); } } class MyException extends Exception { public MyException() { super(); } public MyException(String message) { super(message); } public MyExc