執行時異常與檢查時異常

2021-10-04 21:46:51 字數 410 閱讀 1221

檢查時異常為語法錯誤或邏輯錯誤

執行時異常編譯器不檢查但在執行時會影響後面**的執行

1.nullpointerexception:空指標異常

2.arithmeticexception:數學異常

3.arrayindexoutofbound***ception:陣列越界

4.securityexception:安全異常

5.illegalargumentexception:非法引數異常

6.arraystoreexception:陣列成員型別異常

7.negativearraysizeexception:負長度陣列

public class fire catch(exception t)finally

}

檢查異常與執行時異常(非檢查異常)的區別

檢查異常和非檢查異常的類 檢查異常是exception的本身或者子類 例如 ioexception 輸入輸出異常 filenotfoundexception 檔案沒發現異常 sqlexception sql異常 非檢查異常是runtimeexception的本身或子類 例如 算數異常 arithme...

執行時異常

常見的幾種如下 nullpointerexception 空指標引用異常 classcastexception 型別強制轉換異常。illegalargumentexception 傳遞非法引數異常。arithmeticexception 算術運算異常 arraystoreexception 向陣列中...

執行時期異常

runtimeexception和他的所有子類異常,都屬於執行時期異常。nullpointerexception,arrayindexoutofbound ception等都屬於執行時期異常.執行時期異常的特點 1 方法中丟擲執行時期異常,方法定義中無需throws宣告,呼叫者也無需處理此異常 2 ...