Java 教程
以下實例演示了使用 System 類的 System.err.println() 來展示異常的處理方法:
以上代碼運行輸出結(jié)果為:
Caught Exception getMessage():My Exception getLocalizedMessage():My Exception toString():java.lang.Exception: My Exception printStackTrace(): java.lang.Exception: My Exception at ExceptionDemo.main(ExceptionDemo.java:5)其他擴展