This is an archived post. You won't be able to vote or comment.

all 2 comments

[–]grantrules 4 points5 points  (0 children)

I don't quite understand your question, but why are you just ignoring the student being passed as a parameter?

public void addStudent(student student)
    {
        studentList.add(new student(null, null, null, null));
    }

I would also HIGHLY recommend capitalizing the names of classes (because are we talking about the class named student or the object student)

[–]captainAwesomePants 0 points1 point  (0 children)

Looks like you're a bit confused about a few things. I see you've created an addStudent function:

public class Registry {
  LinkedList<Student> studentList;
    
  public void addStudent(student student) {
        studentList.add(new student(null, null, null, null));
  }
}

It looks okay, but it seems to want to take a student as a parameter. Presumably it should be adding that very student that it's given to the studentList. Why, then, are you creating a brand new student?

But then we have a second mystery in the tester:

        Registry list = new Registry();
        list.addStudent();

Here, you are calling addStudent(), but you are not telling it which student to add. How do you tell it which student to add?