java中的foreach

Queue<String> myQueue = new LinkedList<String>();
myQueue.add("A");
myQueue.add("B");
myQueue.add("C");
myQueue.add("D");

List<String> myList = new ArrayList<String>(myQueue);

for (String theFruit : myList)
  System.out.println(theFruit);

posted @ 2009-12-23 00:55  Fan Zhang  阅读(150)  评论(0编辑  收藏  举报