首页 > 编程语言 > 详细

java常见异常和错误

时间:2017-05-26 23:10:20      阅读:469      评论:0      收藏:0      [点我收藏+]

异常

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

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

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!