ArrayList<Integer> list = new ArrayList<>();
list.add(10);
list.add(20);
list.add(30);
list.set(1, 99);
System.out.println(list.get(1));What is printed?
- A
30
- B
10
- C
20
- Dcheck_circle
99
Explanation
set(1, 99) replaces the element at index 1 with 99. get(1) returns the new value 99.