Hello !
I need to add a Arraylist with the name sports but after compiling the console shows up two errors I can’t identify. Can somebody help me correct this code?
the errors are :
GeneralizationsD.java:7: error: cannot find symbol
Arraylist sports = new Arraylist();
^
symbol: class Arraylist
location: class GeneralizationsD
GeneralizationsD.java:7: error: cannot find symbol
Arraylist sports = new Arraylist();
^
symbol: class Arraylist
location: class GeneralizationsD
2 errors
my code is:
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 () {
System.out.println(city + " was founded in " + majorCities.get(city));
}
*/
}
}