How do i access methods from an arraylist?
At the moment i have an arraylist as so:
ArrayList<Client> clients = new ArrayList<Client>();
and I've filled this arraylist with the details of the clients themselves, including things like their name, address, salary, etc.
I can't seem to access the methods of the Client class from the ArrayList, all I end up with is an error when i try to do so. For example, I tried to access the address details of the first client in the arraylist as so:
clients.get(0).getAddress();
but this just gave me an error. Can someone please tell me what im doing wrong?
Re: How do i access methods from an arraylist?
If you want help with errors, please post the full error message text and stack trace, if present.
It also helps if you post the relevant code in full. I can't see what you added to the clients list, or what the Client code is, etc., and I don't know what the error details were. I'm not going to guess when I know you could post all that information.
Thus the task is not so much to see what no one has yet seen, but to think what no one has yet thought about that which everybody sees...
E. Schrodinger