Eu achei isto no livro:
More formally, let’s describe the enhanced for as follows:
for(declaration : expression)
The two pieces of the for statement are
declaration - The newly declared block variable, of a type compatible with the elements of the array you are accessing. This variable will be available within the for block, and its value will be the same as the current array element.
expression - This must evaluate to the array you want to loop through. This could be an array variable or a method call that returns an array. The array can be any type: primitives, objects, even arrays of arrays.
Exemplos:
int x;
long x2;
Long [] La = {4L, 5L, 6L};
long [] la = {7L, 8L, 9L};
int [][] twoDee = {{1,2,3}, {4,5,6}, {7,8,9}};
String [] sNums = {"one", "two", "three"};
Animal [] animals = {new Dog(), new Cat()};
// legal 'for' declarations
for(long y : la ) ; // loop thru an array of longs
for(long lp : La); // autoboxing the Long objects
// into longs
for(int[] n : twoDee); // loop thru the array of arrays
for(int n2 : twoDee[2]); // loop thru the 3rd sub-array
for(String s : sNums); // loop thru the array of Strings
for(Object o : sNums); // set an Object reference to
// each String
for(Animal a : animals); // set an Animal reference to each
// element