For Each Loop


#1

For the ‘for each’ loop in the example provided

for(Integer temperature : weeklyTemperatures) {
System.out.println (temperatures)
}
When was the Array data entered under weeklyTemperatures redefined as temperature? is that what the For Each Loop did at the start of the statement?


#2

It is defined in the loop context as a local reference that a reader can understand. All the labels are for humans, not the computer.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.