Question 13
Back to Exercise
A record has a component List<String> tags holding an ArrayList. What can still change?
- A Nothing
- B The list's contents – the record only fixes the reference; copy it with List.copyOf in the compact constructor Correct
- C The reference itself
- D The record's class
Correct Answer: Option B
Records are shallowly immutable.
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!