* Runtime exceptions:
在定義方法時不需要聲明會拋出runtime exception; 在調用這個方法時不需要捕獲這個runtime exception;
runtime exception是從java.lang.RuntimeException或java.lang.Error類衍生出來的。
* Checked exceptions:
定義方法時必須聲明所有可能會拋出的checked exception; 在調用這個方法時,必須捕獲它的checked exception,
不然就得把它的exception傳遞下去; checked exception是從java.lang.Exception類衍生出來的。





從邏輯的角度來說,checked exceptions和runtime exception是有不同的使用目的的。
checked exception用來指示一種調用方能夠直接處理的異常情況。而runtime exception則用來指示一種調用方本身無法處理或恢復的程序錯誤。

















java.lang.RuntimeException
(程序默認拋出的異常,不需要捕獲)
BufferOverflowException,ClassCastException,
DOMException,IndexOutOfBoundsException,
NullPointerException
javax.management.modelmbean.XMLParseException
java.sql.SQLException ...