public void addStudent(String student) {
String [] temp = new String[students.length * 2];
for(int i = 0; i < students.length; i++){
temp[i] = students[i];
}
students = temp;
students[numberOfStudents] = student;
numberOfStudents++;
}
public String[] getStudents() {
String[] copyStudents = new String[students.length];
return copyStudents;
}
I'm trying to get the method getStudents to return a copy of the array that I made in the addStudent method. I'm not sure how to go about this.