I have an array of objects, and i'm looking to check if a variable in the object has a particular name. Eventually id like to do it for every object in the array, but i only was testing it on the first index. Im not sure if an arraylist would be better for this. (I have separate faculty/classroom/course/textbook/name classes)
public static void startCourse(){
Course[] course = new Course[4];
Scanner input = new Scanner(System.in);
for(int i = 0;i < course.length;i++){
System.out.println("Enter Course Number and course title: ");
String courseNumber = input.nextLine();
String courseTitle = input.nextLine();
course[i] = new Course(courseNumber,courseTitle);
//FACULTY
System.out.println("Faculty: /nEnter First Name: ");
String facultyfName = input.nextLine();
System.out.println("Enter Last Name: ");
String facultylName = input.nextLine();
course[i].setFaculty(new Faculty(facultyfName,facultylName));//doesnt set name in constructor???
course[i].getFaculty().getName().setfName(facultyfName);
course[i].getFaculty().getName().setlName(facultylName);
course[i].setTextbook(new Textbook("Intro to java","123456",59.99));
course[i].setClassroom(new Classroom("R540",26,true));
Student student1 = new Student("Yulissa","Lucero");
Student student2 = new Student("Aaron","Folborg");
Student[] students = {student1,student2};
//input.close();
System.out.println(course[i]);
//System.out.println(students);
}
System.out.println(course[0].getFaculty().getName().equals("Ben"));
}