@
@
@Qubbed2020-06-08 17:07:33
Java
@Qubbed, 2020-06-08 17:07:33

ArrayList throws an error, what should I do?

I study ArrayList, I try to write it down, but here, Eclipse gives an error. He swears at the inscription "ArrayList". Here is the error "The type ArrayList is not generic; it cannot be paramitrazed with arguments" as I understand it, it says here that it does not work in Integer, however, on the site where I study Java it says that it does not work with "Int", and with "Integer" just works. What is the point then? The code itself:

package ffd;

public class ArrayList {

  public static void main(String[] args) {
    // TODO Auto-generated method stub
    ArrayList<Integer> list = new ArrayList<>();
    list.add(22);
    list.add(54);
    list.add(69);
  }

}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2020-06-08
_

ArrayList<Integer> list = new ArrayList<>();

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question