0

I'm writing a code that is using ArrayList
this is the part that is giving me the error. There are several instancses of this error but I figure that if I can get once fixed I can fix them all.

ArrayList <Student> studentList = new ArrayList <Student>();
		ArrayList <Course> courseList = new ArrayList <Course>();

		if(studentExists(s.getStudentID()) != -1)

it gives me this error

E:\Registration.java:32: cannot find symbol
symbol : method getStudentID()
location: class java.lang.Object
if(studentList.get(i).getStudentID().equals(str))

3
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by masijade
0

You don't show what code is getting that "s" object s.getStudentID() but "s" is not getting cast to Student. It's still just Object, as indicated by the error message.

0

Of course. Never payed attention to that, as casting should no longer be needed when using Generics, but you're right, we have no idea how he defined "s". (And me, idiot, completely overlooked "Object" in the error message.)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.