13/13-4

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-java/lessons/data-structures/exercises/generalizations-data-structures
i have no idea where to type the for each loop “System.out.println(sport);”

```

import java.util.*;

public class GeneralizationsD {
public static void main(String args) {

ArrayList sports = new ArrayList();
sports.add(“Football”);
sports.add(“Boxing”);

	for(String sports : sports); {
	
  
  
	}

	//Major cities and the year they were founded
	HashMap<String, Integer> majorCities = new HashMap<String, Integer>();

	majorCities.put("New York", 1624);
	majorCities.put("London", 43);
	majorCities.put("Mexico City", 1521);
	majorCities.put("Sao Paulo", 1554);

/*
for () {

		System.out.println(city + " was founded in " + majorCities.get(city));

	}

*/

}

}

<do not remove the three backticks above>

instruction:

The first for each loop in the code editor is missing the code that should be run. Inside of the for each loop, type:

this is the first for each loop

for(String sports : sports) {
		
      
      
	}

inside this you have to wrire

System.out.println(sport);

but see in your code you added a ; after for each loop that is wrong here

  for(String sports : sports);  //remove it
1 Like

[quote=“wilsoa07132, post:1, topic:58350”]
ArrayList<String> sports = new ArrayList<String>();
sports.add(“Football”);
sports.add(“Boxing”);

	for(String sport : sports); {
	
  System.out.println(sport);      
	}

you have to remove sports and make (sport:sports)

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