
Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

public class WaitList { private Student[] array; /* constructor / public WaitList() { array = new Student[0]; } / add student โ expand array if needed / public void add(Student student) { Student[] newArray = new Student[array.length+1]; for (int i = 0; i < array.length; i++) { newArray[i] = array[i]; } newArray[array.length] = new Student(student); array = newArray; } / toString */ public String toString() { String result = ""; for (int i = 0; i < array.length; i++) { result += array[i] + "\n"; } return result; } }