我正在传递一个参数
public void addStudent(String studentName)
{
if (studentName != null)
{ int[] array = new int[NUM_QUIZZES];
for (int i = 0; i < array.length; i++)
{
array[i] = MIN_GRADE;
}
quizMarks.put(formatName(studentName), array);
}
}
> new student, marks set to 0
/**
* returns the quiz marks for a given student
* @param student
* @return the array of quiz marks for this student
*/ public int[] getQuizzes(String student)
{
int[] array = quizMarks.get(student);
if (student != null)
{
for (int arrays : array)
{ System.out.println(arrays);
}
} return array;
}
我想显示标记,但它在StudentDatabase.getQuizzes(StudentDatabase.java:68)中的线程“main”java.lang.NullPointerException中给出了异常:第68行:for(int arrays:array)