[Solved] What goes in to the parentheses of studentList.addStudent()? [closed]


Q: What (if any) argument gets passed in to studentList.addStudent()?

A: That depends entirely on what parameters the addStudent() method of “studentList’s` class takes.

In your case:

  1. studentList is a Manager (poor name for either variable or class, but..)

  2. Manager.addStudent() takes an object of class type Student.

  3. You need to have an object of type Student available when you call addStudent.

One of your challenges in your code is that you currently have no way of giving a “Student” a name or student ID. That’s a problem.

Two solutions:

a) Create “setter” methods for name etc.

… and/or …

b) Create a constructor that accepts name etc. as parameters.

solved What goes in to the parentheses of studentList.addStudent()? [closed]