ArrayList<Integer> list = new ArrayList<>();
list.add(1);
list.add(2);
list.add(3);
list.remove(Integer.valueOf(1));
System.out.println(list);What is printed?
- A
[2, 3, 1]
- B
[1, 3]
- C
[1, 2]
- Dcheck_circle
[2, 3]
Explanation
Integer.valueOf(1) creates an Integer object, so remove(Object) is called, removing the first occurrence of the value 1.