Java #13 Generalizations


Having trouble with this exercise. Returns the error "Did you correctly print out the contents of sports?" I'm not sure what I am missing. Your help is greatly appreciated.

Thank you,


import java.util.*;

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

ArrayList<String> sports = new ArrayList<String>();



	//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));






Hi Ruben,

You are missing the for each loop after sports.add("Boxing"); and the other for each loop at the bottom: which is instruction No. 5.

Hope this helps,