collection-based for loop

Can somebody explain to me why only the first code snippet is valid?

A.

int[] a={2,3,5,7};

for(int i : a) System.out.println(i);

B.

int[] a={2,3,5,7};

int i;

for(i : a) System.out.println(i);

[544 byte] By [kulkuria] at [2007-11-26 21:51:35]
# 1
Why shouldn't it be? You declare an array, and you iterate over it using the new for loop and a variable declared in the loop's head...
CeciNEstPasUnProgrammeura at 2007-7-10 3:45:05 > top of Java-index,Java Essentials,Java Programming...
# 2
By the way, I don't see any collection anywhere.
CeciNEstPasUnProgrammeura at 2007-7-10 3:45:05 > top of Java-index,Java Essentials,Java Programming...