Lesson

Codecademy Learn Java, Iterating over an ArrayList

Lesson Summary

In this Codecademy Learn Java lesson we go over iterating over an ArrayList. In java we can repeat go through the contents of an array using a for loop and the size method. Our for loop is made up of three parts. First we initialize our for loop counter. Then we create a condition that will evaluate to true or false. Then as long as the condition is true we do something, usually increment or decrement our counter. Once an expression evaluates to false the for loop breaks out. In this specific challenge we are asked to create a for loop and iterate over our weeklyTemperatures array. While we iterate through our array, we print out the current value we are in.

Subscribe To Monthly Newsletter. Chance to Win Monthly Prizes

* indicates required


Share: