Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise_10/Exercise_10_09/Course.java #72

Open
hamedghafori2022 opened this issue Nov 18, 2023 · 0 comments
Open

Exercise_10/Exercise_10_09/Course.java #72

hamedghafori2022 opened this issue Nov 18, 2023 · 0 comments

Comments

@hamedghafori2022
Copy link

Course course1 = new Course("Data Structure");

course1.addStudent("Peter Jones");
course1.addStudent("Kim Smith");
course1.addStudent("Anne Kennedy");
course1.addStudent("Steve Boss");

System.out.println("Nmuber of students in course1: " + course1.getNumberOfStudents());
String[] students = course1.getStudents();
for (int i = 0; i < course1.getNumberOfStudents(); i++) {
  System.out.print(students[i] + ", ");
}
System.out.println();
course1.dropStudent("Peter Jones");
for (int i = 0; i < course1.getNumberOfStudents(); i++) {
  System.out.print(students[i] + ", ");
}

output:

Nmuber of students in course1: 4
Peter Jones, Kim Smith, Anne Kennedy, Steve Boss,
Peter Jones, Kim Smith, Anne Kennedy, .......

dropstudent always remove last element not specified student. what is solve this bug?
please don't use this library import org.apache.commons.lang3.ArrayUtils;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant