1.Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException
这个问题解决起来很简单,我是很少犯这种错误,这是一次帮别人找错时发现的,所以还是写下来。
数组越界,大家都知道数组下标是从0开始的,for(int i=0;i<=employee.length;i++)这么写就错了,for(int i=0;i<employee.length;i++)这样才行。
2.java.lang.NullPointerException
int i;
Student[] student=new Student[10];
for(i=0;i<10;i++){
student[i]=new Student();//我是这句话没写出的错误,上面只是定义了数组的长度,这里才是真正定义。
student[i].score=10*i;
}