With a little side of applesauce...

Wednesday, March 26, 2008

Java - short-hand for iterating through arrays

This took me a bit to find:

class EnhancedForDemo {
public static void main(String[] args){
int[] numbers = {1,2,3,4,5,6,7,8,9,10};
for (int item : numbers) {
System.out.println("Count is: " + item);
}
}
}

No comments: