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

正文內(nèi)容

course05-對(duì)象和類(存儲(chǔ)版)

  

【正文】 thrown and making your code less efficient. As a result, the runtime system is forced to determine the type of exception before it can decide on the best recovery strategy. 38 ? Quiz ? Question: What exception types can be caught by the following handler? 異常 (Exception) ... } catch (Exception e) { ... } catch (ArithmeticException a) { ... } ? Answer: This first handler catches exceptions of type Exception。 } public static void h() throws MyException { (Throws MyException from h())。 } ? 自定義異常類定義自已的構(gòu)造方法 異常 (Exception) 35 ? 自定義異常 ? 自定義異常類定義自已的構(gòu)造方法 異常 (Exception) class MyException extends Exception { private int x。 … …。 } catch (IOException e) { (e)。 } catch (IOException e) { (e)。 } } java jex7_9 Exception in thread main“ : / by zero class jex7_9 { public static void main(String args[]) { int i = (args[0])。 } catch (fileCloseFailed) { doSomething。 determine its size。 } } method2 throws exception { call method3。 if (error) return error。 } method2 { call method3。 read the file into memory。 close the file。 public class Test { . . . } class文件 () d:\src1\\jalpha\*.class class文件 () d:\src2\\w3c\*.class d:\src 執(zhí)行 (在根目錄 ) d:\src java –classpath d:\src1。 } import graphics.*。 … … Circle myCir = new Circle()。 ? 引入 (import)包成員名 import 。 class Test { //Circle c。 import .*。 read the file into memory。 allocate that much memory。 } } 22 ? 為什么采用異常 (Exception) ? 沿方法調(diào)用堆棧逆向 (回溯 )傳播錯(cuò)誤 異常 (Exception) method1 { call method2。 error = call method3。 } catch (exception) { doErrorProcessing。 } readFile { try { open the file。 } catch (readFailed) { doSomething。 int b = 24/a。 (c)。 } } } try { . . . } catch (ArrayIndexOutOfBoundsException e) { (e)。 } } } 32 ? 異常的拋出 ? 主動(dòng)拋出異常 異常 (Exception) void parseObj(String s) throws NullPointerException { if (s == null) throw new NullPointerException()。 } } } 運(yùn)行結(jié)果 : Throw SimpleException from f() SimpleException Caught it! 34 ? 自定義異常 ? 自定義異常類必須是 ? ? Exception() Constructs a new exception with null as its detail message. ? Exception(String message) Constructs a new exception with the specified detail message. ? 自定義異常類可以不定義構(gòu)造方法 ? SimpleException() { super()。
點(diǎn)擊復(fù)制文檔內(nèi)容
物理相關(guān)推薦
文庫(kù)吧 www.dybbs8.com
備案圖鄂ICP備17016276號(hào)-1