ArrayListTest

ArrayListTest - staff.add("Romeo");...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
import java.util.List; import java.util.ArrayList; import java.util.LinkedList; import java.util.Iterator; public class ArrayListTest { public static void main(String[] args) { ArrayList<String> staff = new ArrayList<String>(); //LinkedList<String> staff = new LinkedList<String>(); staff.add("Dick"); staff.add("Harry");
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: staff.add("Romeo"); staff.add("Tom"); printList(staff); System.out.println(staff.get(2)); staff.set(2, "Karen"); printList(staff); } public static void printList(List staff) { System.out.println(); Iterator iter = staff.iterator(); while (iter.hasNext()) System.out.println(iter.next()); } }...
View Full Document

This note was uploaded on 06/07/2010 for the course CS 201 taught by Professor Staff during the Spring '08 term at Iona.

Ask a homework question - tutors are online