ArrayList<String> list = new ArrayList<>();
boolean r = list.add("hello");
System.out.println(r + " " + list.size());What is printed?
- Acheck_circle
true 1
- B
false 1
- C
true 0
- D
1 true
Explanation
ArrayList.add(E) always returns true and appends to the end, increasing size to 1.