// Returns an ArrayList of teachers who teach the specified subject public ArrayList<Teacher> getTeachersBySubject(String subject) ArrayList<Teacher> result = new ArrayList<Teacher>(); for (Teacher t : teacherList) if (t.getSubject().equals(subject)) result.add(t);
Always ensure import java.util.ArrayList; is at the top of your file.
Two months later, something unexpected happened. The district announced a pilot program: AI-generated seating charts based on teacher inputs. Miriam’s detailed notes made her class the test case. The algorithm analyzed her answers—not the canned drop-downs, but her real observations—and produced a seating chart that placed Jaylen next to a quiet coder, Sofia at a standing desk near the supply cabinet, and Marcus with a bilingual peer tutor.
Why does CodeHS include ? It teaches three critical skills:
You need to declare a static ArrayList that holds Student objects. Using the static keyword is crucial because it ensures the list belongs to the class itself, rather than individual student instances.
