Java Professional — Hard
Key points
- Java 5 introduced volatile to prevent reordering of writes in double-checked locking
- This ensures that a fully constructed object is visible to all threads
- The volatile keyword establishes a happens-before relationship, ensuring correct object initialization
Ready to go further?
Related questions
