Skip to content
Sharp

Career Growth · interview question

In a code review, what is a severe concurrency issue you might spot in a Java program?

Multiple choiceHardchapter-20-curatedpremiumcareer-growthtransitioning-to-senior
Choose one answer
Answer and explanation

Correct answer

A. Implementing a singleton with double-checked locking without volatile.

Why

Using double-checked locking without the volatile keyword can lead to a severe concurrency issue due to improper memory visibility guarantees. The volatile keyword ensures changes to a variable are visible to all threads, which is crucial for thread-safe singleton implementation.

Test yourself on Career Growth

A free test with instant, explained results. No account needed.

Start free test
All Career Growth questions →