Skip to content
Sharp

Concurrency basics · interview question

Why does the 'synchronized' keyword in Java matter in practice?

Multiple choiceEasychapter-15-curatedpremiumconcurrencysynchronized-and-locks
Choose one answer
Answer and explanation

Correct answer

D. To control access to a shared resource by multiple threads.

Why

The 'synchronized' keyword is used to prevent multiple threads from accessing a shared resource simultaneously, which helps avoid race conditions.

Test yourself on Concurrency basics

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

Start free test
All Concurrency basics questions →