7 | Iterating over a array list


My code seems to be working fine and am able to print the output also. But I am getting the Error "Use the example to help you create the for loop and use the get method."

import java.util.ArrayList;

public class TemperaturesC {
	public static void main(String[] args) {

		ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
		weeklyTemperatures.add(2, 111);
for (int j = 0 ; j < weeklyTemperatures.size(); j++)
  System.out.println( weeklyTemperatures.get(j) );



That course uses regexes too much and is therefore often more concerned with what the author anticipated than with what meets what the instructions describe.

I suggest cleaning up the formatting and trying to get it as close as possible to any examples that you were meant to follow

This funny thing is what you need to satisfy:


As you can see it's a huge mess and what passes is limited by the imagination and thoroughness of the person who wrote that pattern.


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