Ok so this is probably a very beginner question but...
Right now I have an object called Person with a method on it called setName
I am in my main class and I have declared
List People = new LinkedList();
What I want to do is simply call the setName function of the object in the first position. I have found that this is very easy to do when working with an array of People. All I would do would be to say
People[0].setName("steve");
But since it is in a linkedlist I am having troubles.
I tried using the "get" method like so...
People.get(0)
but then it doesn't allow me to use my user defined methods so I can't set the name.
What is the best way to get an object out of a linked list and access its methods and instance variables?
thanks in advance