int[] arr = {3, 1, 4, 1, 5};
ArrayList<Integer> list = new ArrayList<>();
for (int x : arr) list.add(x);
System.out.println(list.size());What is printed?
- A
0
- B
4
- C
3
- Dcheck_circle
5
Explanation
Each of the 5 elements is added to the list, so size is 5.