无法解析java.lang.nullpointerexception [英] Unable to resolve java.lang.nullpointerexception
本文介绍了无法解析java.lang.nullpointerexception的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Exception in thread "main" java.lang.NullPointerException
at EnrollmentMain.main(EnrollmentMain.java:211)
在运行以下程序时获取此异常我不明白这是什么原因你能解释我怎么做?我已经搜索了1-2小时来解决这个购买我无法理解这个例外不断出现原谅我,因为我是新的感谢您的理解和考虑。
我尝试过:
这是第211行:
Getting this exception while running following program I don't understand what is this could you explain me how? i've search like 1-2hours to resolve this buy i couldn't understand this exception keeps popping up pardon me because I'm new thanks for your understanding and consideration.
What I have tried:
Here's the line 211:
for(int i=0; i<=count;i++){
System.out.println(students[i].getID());
}
推荐答案
如果count
是学生
数组的长度然后循环的上限是错误的:更改从
Ifcount
is the length of thestudents
array then the upper limit of the loop is wrong: Change from
引用:
for(int i = 0; i< = count; i ++){
for(int i=0; i<=count;i++){
to
to
for(int i=0; i<count;i++){
这篇关于无法解析java.lang.nullpointerexception的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文