ArrayList<Integer> list = new ArrayList<>();
list.add(5);
list.add(10);
list.add(15);
int removed = list.remove(0);
System.out.println(removed + " " + list.get(0));What is printed?
- Acheck_circle
5 10
- B
0 5
- C
5 5
- D
10 15
Explanation
remove(0) on an ArrayList<Integer> calls remove(int index), returning the removed value 5. After removal, index 0 contains 10.