I have a class containing some basic info about a course and an ArrayList containing objects of student class.
Is there a smarter way of editing the toString() method in order to print out information about the course and each student (on a separate line each) then this:
public String toString() {
System.out.println("Course " + this.name + ", Teacher: " + this.teacher;
for (Student stud: studentList) {
System.out.println(stud);
}
retutn "";
I have already set the Student class' toString() method to print Student info.
*edit: Realised I made a mistake with print(stud), so changet to println(stud)
System.out.println(stud);println