List stuff = new ArrayList();
stuff.add("Apple");
stuff.add("Orange");
// what's the last item? Indexes are zero based!
System.out.println(stuff.get(stuff.size() - 1));
// change the first item to a pear.
stuff.set(0, "Pear");
// now iterate
Iterator it = stuff.iterator();
while(it.hasNext())
{
String item = (String)it.next();
System.out.println(item);
}