Deleting instances of classes from a list

So I have a class 'studentlist' and another class 'student' which goes into a list in studentlist.

I then have a script that creates a new instance of studentlist and creates instances of 'student' that go into studentlist's' list.

However when I try to manipulate the list such as writing

studentlist.remove(0)

to remove the first instance of the student class in studentlist, the compiler returns an error. what is going wrong exactly? i have obviously used this type of code many times before to remove certain integers from lists, according to their index number, but when you have a list of class instances it doesn't work. Can anyone tell me why?

The first class is the AddressBookEntry class, which feeds into the list in the second AddressBook class. The last part is the script which creates a new AddressBook and then creates new AddressBookEntry classes to go into that class. The add function works fine, but the remove one at the end there throws up the following error.

For the code written I would expect it to delete the first instance of the AddressBookEntry class that was instantiated in AddressBook's list as I am referring to that by it's index number, but it's not working. Is this due to the list in AddressBook being full of instantiated classes and not stuff like ints or strings?

I haven't used this language, but since this is a new to Java forum I'll give you the benefit of my ignorance...

Doesn't the error message say it all? Your AddressBook class has an add() method so you can call add() with the new entry. But you get an error when you call remove() because there is no remove() method defined anywhere.

Try adding the following to the definition of AddressBook:

Java Code:

def remove(int ndx){
// do stuff to ensure ndx is a valid index and, if it is,
// remove the item from the array.
}