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.
<Below this line, add a link to the EXACT exercise that you are stuck at.>
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 sports = new ArrayList();
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));
	}



}

}

<do not remove the three backticks above>

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

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.