public StudentLottery() {
ArrayList<Student> list = new ArrayList<Student>();
}
public void addStudents() {
Scanner keyboard=new Scanner(System.in);
String input;
String id;
String name;
Student s;
System.out.println("Enter? (y or n):");
input=keyboard.nextLine();
while (!(input.equals("n"))){
System.out.println("Name:");
name=keyboard.nextLine();
System.out.println("ID:");
id=keyboard.nextLine();
s=new Student(name,id);
if (!(list.contains(s)))
list.add(s);//error
System.out.println("Enter? (y or n):");
input=keyboard.nextLine();
}
}
error occurs on list.add(s), I thought arrayLists could accept any type of object, but this arraylist only likes strings, so I'm unsure what I should be doing to fix this, so that my arraylist will accept student objects
jcreator says no suitable add method found