1. 程式人生 > >最近遇到的異常與錯誤總結

最近遇到的異常與錯誤總結

reference dstat 異常 總結 ria num 空指針 格式化 first

異常
NumberFormatException 數字格式化異常
ArithmeticException 算術異常
ArrayIndexOutOfBoundsException 數組超出綁定異常:沒有輸入參數,或輸入的參數不夠
NullPointerException 空指針異常:使用了未實例化的對象
NoSuchMethodError:main 找不到主方法
ClassCastExeption:A 類轉換異常
IllegalThreadStateException:非法的線程狀態異常
IOException: IO流異常


錯誤
integer number too large
name has private access in Person 無法訪問封裝屬性
call to this must be first statement in constructor 錯誤的調用,只能放在構造方法的首行
recursive constructor invocation 遞歸調用了構造方法
non-static variable name cannot be referenced from a static context 不能調用非static屬性
non-static method fun() cannot be referenced from a static context 不能調用非static方法
Singleton() has private access in Singleton 無法實例化
print() in Student cannot override print() int Person; attempting to assign weaker access privileges; was public 覆寫父類中的方法,便縮小了權限,錯誤
cannot inherit from final A
print() in B cannot override print() in A; overridden method is final
cannot assign a value to final variable INFO
OutOfMemoryError:

最近遇到的異常與錯誤總結