Don’t use square brackets with your ArrayList
. Lists are not arrays.
ArrayList<Integer> list = new ArrayList<>(5);
Add to it with
list.add(sc.nextInt());
Remove from it with
list.remove(index);
2
solved I can’t understand ArrayList[]= new Arraylist[