Skip to content
Sharp

Java Threading · interview question

When multiple threads increment a shared counter without proper synchronization, why might the final count be incorrect?

Multiple choiceMediumchapter-15-curatedpremiumjava-threadingrace-conditions
Choose one answer
Answer and explanation

Correct answer

C. Because incrementing is not an atomic operation.

Why

Incrementing involves reading, modifying, and writing back the value, which are separate steps. Without synchronization, these steps can be interleaved by multiple threads, causing lost updates.

Test yourself on Java Threading

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

Start free test
All Java Threading questions →