Browsed by
月份:2020年4月

【Jdk1.5】新特性

【Jdk1.5】新特性

1 . forEach :

forEach 遍历 List:

public static void main(String[] args) {
		// List 遍历
		String[] atp = {"Rafael", "Djokovic", "Wawrinka" };
		List<String> players = Arrays.asList(atp);
		// forEach 
		for (String player : players) { 
			System.out.println(player + "; ");
		}
}