Quotes help make search much faster. Example: "Practice Makes Perfect"

Thursday, October 29, 2015

Codecademy > Learn Java > Iterating over an ArrayList Sample Solution


import java.util.ArrayList;

public class TemperaturesC {

public static void main(String[] args) {

ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
weeklyTemperatures.add(2, 111);

for (int j = 0; j < weeklyTemperatures.size(); j++) {
 System.out.println( weeklyTemperatures.get(j) );
}

}
}

No comments:

Post a Comment


This is an example of scrolling text using Javascript.

Popular Posts