you forgot the <> after the “new” command.
ArrayList<> is a generic collections class, so you have to specify what kind of data it will hold. by declaring the datatype between the diamonds.
I have egual problem, but is write correct
ArrayListsports=new ArrayList();
sports.add(“Football”);
sports.add(“Boxing”);
test run good but come this message:
Did you create an ArrayList named sports?
the correct syntax is ArrayList<Integer> arrayName = new ArrayList<Integer>();
Integer can be swapped with any data type you want to store in this ArrayList.
but with the new Java 8 you can use ArrayList<Integer> arrayName = new ArrayList<>(); < you can leave out the 2nd explicit declaration.
but that doesn’t work with Codecademy’s version of Java.