package test;import java.util.Iterator;import java.util.LinkedList;public class LinkedListTest { public void linkedList() { LinkedList ll = new LinkedList(); ll.add("h"); ll.add("e"); ll.add("l"); ll.add("l"); ll.add("o"); ll.add("!"); Iteratorit = ll.iterator(); while (it.hasNext()) { System.out.print(it.next()); } } public static void main(String[] args) { LinkedListTest llt = new LinkedListTest(); llt.linkedList(); }}
//====输出结果=====================
Hello!