java 报错:Exception in thread "main" java.lang.NullPointerException
部分代码:publicclassUniversityextendsPlace{privatestaticintcnumber=1;privatestaticintsnum...
部分代码:
public class University extends Place{
private static int cnumber=1;
private static int snumber=10;
private static int tnumber=1;
private ClassRoom[] cla= new ClassRoom[100];
private Student[] stu=new Student[100];
private Teacher[] tea=new Teacher[100];
public University(){
for(int i=0;i<10;i++)
{
stu[i].age=18;//这行报错at homework.University.<init>(University.java:15)
stu[i].ID=10080101+i;
stu[i].classRoom="518";
} 展开
public class University extends Place{
private static int cnumber=1;
private static int snumber=10;
private static int tnumber=1;
private ClassRoom[] cla= new ClassRoom[100];
private Student[] stu=new Student[100];
private Teacher[] tea=new Teacher[100];
public University(){
for(int i=0;i<10;i++)
{
stu[i].age=18;//这行报错at homework.University.<init>(University.java:15)
stu[i].ID=10080101+i;
stu[i].classRoom="518";
} 展开
3个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询