13. Generalizations

<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>

<Below this line, add a link to the EXACT exercise that you are stuck at.>
https://www.codecademy.com/courses/learn-java/lessons/data-structures/exercises/generalizations-data-structures?action=lesson_resume&link_content_target=interstitial_lesson

<In what way does your code behave incorrectly? Include ALL error messages.>
I don’t understand how to start the expression
for(String sport : sports) System.out.println(sport):wink: {

	GeneralizationsD.java:13: error: illegal start of expression
	for(String sport : sports) System.out.println(sport);) {
	                                                     ^

1 error
^
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 () {

		System.out.println(city + " was founded in " + majorCities.get(city));

	}

*/

}

}

<do not remove the three backticks above>

Hello

There is an extra open bracket -

Delete the bracket after the ; .
Run the code again.

Let me know if it works.

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