I'm learning arrays for the first time and have been unable to figure out why i keep getting errors. This is my constructor for my class called Grades.
public Grades(float [] g){
for(int i = 0; i < g.length; i++){
if(g[i] >= 0 && g[i] <=100){
listOfGrades[i] = g[i];
}
}
}
From my understanding this should run through each index of the array in this case the object was tested as:
float[] a = {70, 60, 80,90,100};
Grades allQuizGrades = new Grades(a);
Why do i get a null pointer exception?