Skip to content
Sharp

Java Threading · interview question

Why is using a non-synchronized method to update a shared variable in a multithreaded environment a problem in practice?

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

Correct answer

B. It can lead to race conditions.

Why

Without synchronization, multiple threads can access and modify a shared variable simultaneously, leading to race conditions where the final state of the variable depends on the timing of thread execution.

Test yourself on Java Threading

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

Start free test
All Java Threading questions →