What is the output?
List<Integer> l = new ArrayList<>(List.of(10, 20, 30)); l.remove(1); System.out.println(l);
- [20, 30]
- [10, 20]
- [10, 30]
- [10, 20, 30]
An int argument picks the overload remove(int index), so the element at index 1 (20) goes. remove(Integer.valueOf(1)) would remove by value.
Play Problem Solving ▸