how do I rewrite this using ArrayList public class Course C
how do I rewrite this using ArrayList
public class Course {
 //Create Students
 public String courseName;
 public String []students = new String [100];
 private int NumberOfStudents;
//Add Course
public Course(String courseName) {
 this.courseName = courseName;  
 }
 public void addStudent(String student){
 students[NumberOfStudents] = student;
 NumberOfStudents++;
 }
//Return Student
 public String[]getStudents(){
    return students;
 }
 public int getNumberOfStudents(){
    return NumberOfStudents;
 }
 public String getcoursName(){
    return courseName;
 }
 public void dropStudent(String student){
    for (int i = 0; i < NumberOfStudents; i++) {
    if (students[i].equals(student)) {
    // Move students[i + 1] to students[i], etc.
    for (int k = i + 1; k < NumberOfStudents; k++) {
    students[k - 1] = students[k];
 }
    NumberOfStudents--;
    break;
    }
    }
 }
 //increase Array when student are added by 1
 public void addArray() {
    if (NumberOfStudents >= students.length) {
 String old [] = new String[students.length * 1];
    System.arraycopy(students, 0, old, 0, students.length);
 students = old;
 }
 }//end increase Array
// add method to drop student
 //Remove Student from course
int removeStudent = -1;{
for (int i = 0; i < NumberOfStudents; i++) {
 if (students[i].equals(students)) {
 removeStudent= i;
 if (removeStudent!= -1) {
 for (i = removeStudent; i < NumberOfStudents; i++)
 students[i] = students[i+1];
 } // end if found
   
 // decrement number of students by 1
 NumberOfStudents--;
 }
 }
int clear = 0; {
for (int i = 0; i < NumberOfStudents; i ++){
 students [i] = null;
 NumberOfStudents = 0;
 }
   
 }
 }
 }
Solution
import java.util.ArrayList; public class Course { //Create Students public String courseName; public ArrayList![how do I rewrite this using ArrayList public class Course { //Create Students public String courseName; public String []students = new String [100]; private int how do I rewrite this using ArrayList public class Course { //Create Students public String courseName; public String []students = new String [100]; private int](/WebImages/21/how-do-i-rewrite-this-using-arraylist-public-class-course-c-1050235-1761546931-0.webp)
![how do I rewrite this using ArrayList public class Course { //Create Students public String courseName; public String []students = new String [100]; private int how do I rewrite this using ArrayList public class Course { //Create Students public String courseName; public String []students = new String [100]; private int](/WebImages/21/how-do-i-rewrite-this-using-arraylist-public-class-course-c-1050235-1761546931-1.webp)
