Q:

Making and adding an ArrayList in Eclipse

So I'm new to coding and my professor just gave us a assignment where we work from scratch and I'm stuck on making an arraylist at least I'm not sure if I have it down correctly and adding to the array list.
public class Roster {
    public Roster() {
        ArrayList<Student> students = new ArrayList<Student>();

Create a new class Roster, which will manage a collection of students. Put this class in the model package.
Add a default constructor. In this constructor, create a data member of an empty ArrayList of Student objects.
Add a method which can add a Student object to the roster. Don’t forget to check if the Student object is null (if so, throw an IllegalArgumentException).
Add a method so that a student can be added, not with a Student object, but with a ﬁrst name, last name, and a grade. Use the same method name that was used in the previous instruction.

I'm confused on these four steps of making it and adding to the array list can someone help me?

A:

Declare students as a member of the class so that other methods can access it.
public class Roster
{
  ArrayList<Student> students;
  public Roster()
  {
    students = new ArrayList<Student>();
  }
  public void addStudent(Student student)
  {
    if(student == null)
      throw new IllegalArgumentException;
    students.add(student);
  }
  public void addStudent(String firstname, String lastname, String grade)
  {
   Student student = new Student(firstname, lastname, grade);//assuming there is this constructor
   //If you don't have that constructor you might have some setters use them.
   students.add(student);
  }
}

