ArrayList<Integer> list = new ArrayList<>();
list.add(1);
list.add(2);
list.add(3);
list.add(0, 99);
System.out.println(list);What is printed?
- A
[1, 99, 2, 3]
- B
[1, 2, 3, 99]
- C
[99, 2, 3]
- Dcheck_circle
[99, 1, 2, 3]
Explanation
add(0, 99) inserts at the front, shifting all other elements right.