Java #13 Generalizations


#1

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,

Ruben


import java.util.*;

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

ArrayList<String> sports = new ArrayList<String>();
  
  sports.add("Football");
	sports.add("Boxing");

System.out.println(sport);

	}

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

	}

*/

}

}


#2

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,

jw