資源簡介
Java 捕獲單個異常(基礎篇-實例162).zip
代碼片段和文件信息
package?com.mingrisoft.exception;
public?class?CatchException?{
????public?static?void?main(String[]?args)?{
????????try?{//?定義try塊
????????????System.out.println(“進入try塊“);
????????????@SuppressWarnings(“unused“)
????????????Class>?clazz?=?Class.forName(““);//?得到一個空的Class對象
????????????System.out.println(“離開try塊“);
????????}?catch?(ClassNotFoundException?e)?{//?定義catch塊
????????????System.out.println(“進入catch塊“);
????????????e.printStackTrace();
????????????System.out.println(“離開catch塊“);
????????}?finally?{//?定義finally塊
????????????System.out.println(“進入finally塊“);
????????}
????}
}
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件?????????232??2015-08-28?13:54??.classpath
?????文件?????????379??2015-08-28?13:54??.project
?????文件????????1171??2015-08-28?13:54??bin\com\mingrisoft\exception\CatchException.class
?????文件?????????645??2015-08-28?13:54??src\com\mingrisoft\exception\CatchException.java
- 上一篇:Java 實現文本域控件的浮雕化邊框
- 下一篇:Java 方法中拋出異常
評論
共有 條評論