java常見異常和錯誤

來源:互聯網
上載者:User

標籤:java 異常 錯誤

異常

1.NumberFormatException  數字格式化異常

2.ArithmeticException 算術異常

3.ArrayIndexOutOfBoundsException  數組超出綁定異常:沒有輸入參數,或輸入的參數不夠

4.NullPointerException null 指標異常:使用了未執行個體化的對象

5.NoSuchMethodError:main  找不到主方法

6.ClassCastExeption:A 類轉換異常

7.IllegalThreadStateException




錯誤:

1.integer number too large

2.name has private access in Person 無法訪問封裝屬性

3.call to this must be first statement in constructor  錯誤的調用,只能放在構造方法的首行

4.recursive constructor invocation 遞迴調用了構造方法

5.non-static variable name cannot be referenced from a static context  不能調用非static屬性

6.non-static method fun() cannot be referenced from a static context 不能調用非static方法

7.Singleton() has private access in Singleton 無法執行個體化

8.print() in Student cannot override print() int Person; attempting to assign weaker access 9.privileges; was public 覆寫父類中的方法,便縮小了許可權,錯誤

10.cannot inherit from final A

11.print() in B cannot override print() in A; overridden method is final

12.cannot assign a value to final variable INFO


java常見異常和錯誤

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.