java例程练习(增强的for循环)

import java.util.ArrayList;
import java.util.Collection;


public class Test {
	public static void main(String[] args) {
		int [] arr	= {1, 2, 3, 4, 5};
		for(int i : arr) {
			System.out.print(i + " ");
		}
		System.out.println();
		
		Collection<String> c = new ArrayList<String>();
		c.add(new String("AAA"));
		c.add(new String("BBB"));
		c.add(new String("CCC"));
		for(String o : c) {
			System.out.print(o + " ");
		}
	}
}

posted on 2012-05-01 10:36  Yours风之恋  阅读(140)  评论(0编辑  收藏  举报