13/13:Generalizations I have a problem


I have problem in last question.
I think I code it correctly, but the truth is not.
Where did I get wrong.
I need some suggestions.


GeneralizationsD.java:22: error: cannot find symbol
for (String city : majorCities.ketSet(Integer) )
symbol: variable Integer
location: class GeneralizationsD
1 error

import java.util.*;

public class GeneralizationsD {
	public static void main(String[] args) {
ArrayList<String> sports = new ArrayList<String>();

		for(String sport : 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 (String city : majorCities.ketSet(Integer) ) 
	System.out.println(city + " was founded in " + majorCities.get(city));



This part should correct the problem. You put
"majorCities.ketSet(Integer)" when it should be:


The instructions literally gave you the code they wanted you to enter. Don't try to do more than the lesson wants you to do or it will get confused and say it's wrong. Read step 5 again and follow it exactly as it says.


Ok, I got it and solved it!


Kudos to you, have fun!


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