7.2.8 Teacher Class List Answers -
In inclusive classrooms, two teachers are often assigned to one section (e.g., a General Education teacher and a Special Education teacher). If the funding report is incorrect, the 7.2.8 list is the first place to check.
public ClassList() teacherList = new ArrayList<Teacher>(); 7.2.8 Teacher Class List Answers
If you are currently navigating the CodeHS Java (or JavaScript) curriculum, you have likely encountered the exercise. This problem is infamous among AP Computer Science students because it bridges object-oriented programming (OOP) with real-world data management logic. In inclusive classrooms, two teachers are often assigned
| Mistake | Correct Approach | |---------|------------------| | Using == for string comparison in findTeacher | Always use .equals() for string content | | Forgetting to handle empty lists in getMostExperienced | Add an if (teacherList.isEmpty()) return null; | | Modifying the original teacherList in getTeachersBySubject | Create a new ArrayList for the results | | Returning null instead of an empty list for getTeachersBySubject | Return an empty ArrayList (never null for collections) | | Hardcoding teacher names or subjects | All data must come from the Teacher objects’ getters | This problem is infamous among AP Computer Science
If you try to add the student outside the constructor, the list will not update automatically upon creation.
ArrayList and update the constructor to add each new student to that list automatically. java.util.ArrayList; // 1. Implement the static classList here: // 2. Add the current student (this) to the classList classList.add( .name; }