Main program:
System.out.print("Enter the new student name: ");
String studName = input.nextLine();
newCourse.addStudent(studName);
class:
public void addStudent(String studName){
studentNames[noOfStudents] = studName;
noOfStudents++;
}
After run it show me this error: Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: 3