Adding and deleting from array
i have this peace of code i don't understand : adding: public boolean addCourse(String course) { for (int i = 0; i < numCourses; i++) {//i'm checking whether course is in the list if (courses[i].equals(course)) return false; } courses[numCourses] = course;//if not he is added numCourses++; return true; } removing: public boolean removeCourse(String course) {//i don't understand following so if someone could explain line by line, thx boolean found = false; int courseIndex = -1; for (int i = 0; i < numCourses; i++) { if (courses[i].equals(course)) { courseIndex = i; found = true; break; } } if (found) { for (int i = courseIndex; i < numCourses-1; i++) { courses[i] = courses[i+1]; } numCourses--; return true; } else { return false; } }