Hello, I'm trying to figure out this method were i add courses to a student. and then call it in the main method .
public ArrayList getCourseList(){
return courseList;
}
public boolean addCourse(EnrolledCourse courseName){
for (int i = 0; i <= courseList.size(); ++i )
if(courseList.contains(null)){
courseName.getCoursename();
this.courseList.add(courseName);
return true;
}
return false;
}
then I call it from the main method like student.addcourse(courseName);
but when i run it keeps saying
Exception in thread "main" java.lang.NullPointerException
at cis35a.project.Student.addCourse(class.java:112)
Im also trying to figure out how to drop courses, but am stuck with adding courses.