This is explained in the Java Language Specification (JLS), 14.14.2:
The enhanced for statement has the form:
EnhancedForStatement: for ( FormalParameter : Expression ) Statement FormalParameter: VariableModifiers_opt Type VariableDeclaratorId VariableDeclaratorId: Identifier VariableDeclaratorId []
...
The enhanced for statement is equivalent to a basic for statement of the form:
for (I #i = Expression.iterator(); #i.hasNext(); ) { VariableModifiers_opt TargetType Identifier = (TargetType) #i.next(); Statement }
Thus, the Identifier
is redeclared on each iteration of the loop.