---
# System prepended metadata

title: '010public class Foreach {'

---

# 010public class Foreach {
foreach(陣列元素型別、變數名稱:陣列變數名稱){....}


	public static void main(String[] args) {
		// 1 - 6 => 各出現次數
		int[] point = new int[6];	// 0 - 5
		for (int i=0; i<100; i++){
			point[(int)(Math.random()*6)]++;
		}
		
		for (int value : point){
			System.out.println(value);
		}