13/13

<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.>

<In what way does your code behave incorrectly? Include ALL error messages.>

```

I don’t see the problem with this code.

<do not remove the three backticks above>

I don’t see the problem with this code.

Don’t you need a / at the end of your tag?

<img src="" />

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?

Why?

have a bug, but the sintax is correct.

correct
ArrayListsports=new ArrayList();

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.

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