13/13:Generalizations I have a problem


#1

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.

https://www.codecademy.com/en/courses/learn-java/lessons/data-structures/exercises/generalizations-data-structures?action=resume

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>();
sports.add("Football");
sports.add("Boxing");

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



	}
}


#2

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


#3

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.


#4

Ok, I got it and solved it!


#5

Kudos to you, have fun!


#6

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