Java拡張for文

そんなのもあったなーとか思ってて、要はfor eachじゃね?とかおもったり思わなかったり。
あまり詳しくわかっていなかったので、サンプルソースコード書いておきます。

class Hello {
	public static void main(String args[])
	{
		int [] a = {1,2,3};
		for(int b : a){
			System.out.println(b);
		}
	}
}

カテゴリ

Photo: Jaz. Mine / Unsplash LicensePhoto: Se. Tsuchiya / Unsplash LicensePhoto: Sergio / Unsplash LicensePhoto: Robert Bant / Unsplash LicensePhoto: Zhi Xuan Hew / Unsplash License