🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Immutability and Value Objects: all 10 questions

Quiz: Immutability and Value Objects · Question 7 of 10

Why are immutable objects automatically thread-safe?

Why are immutable objects automatically thread-safe?

  1. A.Java runs them on a single thread
  2. B.They use synchronized methods internally
  3. C.Their state never changes, so threads cannot see a half-updated value
  4. D.They are stored in a special memory area
Answer & explanation

Correct answer: Their state never changes, so threads cannot see a half-updated value

With no writes after construction, there is nothing to race on.

Can you get the rest right without peeking?

Take the timed Quiz: Immutability and Value Objects quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →