freepeople性欧美熟妇, 色戒完整版无删减158分钟hd, 无码精品国产vα在线观看DVD, 丰满少妇伦精品无码专区在线观看,艾栗栗与纹身男宾馆3p50分钟,国产AV片在线观看,黑人与美女高潮,18岁女RAPPERDISSSUBS,国产手机在机看影片

正文內(nèi)容

course05-對象和類(更新版)

2025-09-01 09:20上一頁面

下一頁面
  

【正文】 emoryAllocationFailed) { doSomething。 close the file。 } method1 { try { call method2。 } errorCodeType method2 { errorCodeType error。 } catch (fileCloseFailed) { doSomething。 determine its size。 allocate that much memory。 import .*。 import mygraphics.*。 public class Circle extends Graphic implements Draggable { . . . } ? 利用包成員的規(guī)范名 (包名 +類名 ) myCir = new ()。 ? 引入 (import)整個包成員 import graphics.*。 import mygraphics.*。d:\src2。 } 潛在的問題 : ? What happens if the file can39。 close the file。 } method3 { call readFile。 else proceed。 } method3 throws exception { call readFile。 allocate that much memory。 } } 24 ? 對異常的定義 ? Java語言中定義的異常類 : IOException/NullPointerException ? 詳細(xì)定義見 Java文檔中各個包的 Exception Summary ? 用戶定義自已所需的異常類,描述程序中出現(xiàn)的異常結(jié)果 第 10講 異常 (Exception) class class (嚴(yán)重的問題,但不需程序捕捉的錯誤 ) class ... ... class class class ... ... class (程序應(yīng)該捕捉的錯誤 ) class class (JVM正常運行時拋出的錯誤 ) class ... ... class class class ... ... 25 ? 何時會出現(xiàn)異常 ? ? 方法中已定義了異常的拋出 異常 (Exception) import 。 (i)。 } } } unreported exception 。 } 30 ? 異常處理器 (exception handler) ? finally語句塊 ? There’s often some piece of code that you want to execute whether or not an exception is thrown within a try block. ? finally語句塊在異常處理中是必須執(zhí)行的語句塊 ? 清理現(xiàn)場 ? 關(guān)閉打開的文件 ? 關(guān)閉網(wǎng)絡(luò)連接 異常 (Exception) try { // The guarded region: Dangerous activities // that might throw A, B, or C } catch(A a1) { // Handler for situation A } catch(B b1) { // Handler for situation B } catch(C c1) { // Handler for situation C } finally { // Activities that happen every time } 31 ? 異常的拋出 ? 在一個方法中,拋出異常,同時捕捉 ? 當(dāng)有多個方法調(diào)用時,由特定 (適當(dāng) )的方法捕捉異常 ? 被調(diào)用的方法主動拋出異常 (throws) 異常 (Exception) import 。 } 33 ? 自定義異常 ? 使用 JAVA已有的異常 ?異常的拋出 /捕捉 ? 定義自已特有的異常 ?異常的拋出 /捕捉 異常 (Exception) class SimpleException extends Exception {} public class SimpleExceptionDemo { public void f() throws SimpleException { (Throw SimpleException from f())。 public MyException() {} public MyException(String msg) { super(msg)。 throw new MyException(Originated in h(), 47)。 therefore, it catches any exception, including ArithmeticException. The second handler could never be reached. This code will not pile. 第八講 結(jié)束 !
點擊復(fù)制文檔內(nèi)容
物理相關(guān)推薦
文庫吧 www.dybbs8.com
備案圖鄂ICP備17016276號-1