Question 16
Back to Exercise
What happens with Arrays.asList("a", "b").add("c")?
- A The list grows to 3
- B UnsupportedOperationException – the list has a fixed size Correct
- C Compile error
- D Nothing
Correct Answer: Option B
Wrap it: new ArrayList<>(Arrays.asList(…)) or use List.of for an immutable list.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!