码迷,mamicode.com
首页 > 编程语言 > 详细

java常见异常和错误

时间:2017-05-26 23:33:39      阅读:416      评论:0      收藏:0      [点我收藏+]

标签:java 异常 错误

异常

1.NumberFormatException  数字格式化异常

2.ArithmeticException 算术异常

3.ArrayIndexOutOfBoundsException  数组超出绑定异常:没有输入参数,或输入的参数不够

4.NullPointerException 空指针异常:使用了未实例化的对象

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常见异常和错误

标签:java 异常 错误

原文地址:http://huguangqin2015.blog.51cto.com/10856722/1929956

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!