LearnFrenzy
Sign in Take a free test

Encapsulation · Encapsulation MCQ · Question 12

What is a benefit of immutable objects? Answer, explanation & discussion

  • MCQ
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 12 Back to Exercise

What is an important advantage of immutable objects?

  • A They use less memory
  • B They can be shared freely, including between threads, because no one can change them after construction Correct
  • C They can be modified faster
  • D They do not need constructors
Correct Answer: Option B

Modifications create new objects, so existing ones stay valid forever.

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