LearnFrenzy
Sign in Take a free test

Encapsulation · Encapsulation MCQ · Question 10

Unmodifiable view versus copy Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 10 Back to Exercise

What is the difference between Collections.unmodifiableList(list) and List.copyOf(list)?

  • A No difference
  • B The view reflects later changes to the original list; copyOf is an independent snapshot. Both reject modification. Correct
  • C copyOf allows modification
  • D The view is a deep copy
Correct Answer: Option B

Choose based on whether callers should see later updates.

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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links