Skip to content
Sharp

Concurrency basics · interview question

What does the 'volatile' keyword guarantee in Java?

Multiple choiceEasychapter-15-curatedpremiumconcurrencythe-volatile-keyword
Choose one answer
Answer and explanation

Correct answer

B. Visibility of changes to variables across threads

Why

The 'volatile' keyword ensures that changes to a variable are visible to all threads immediately. It does not guarantee atomicity for operations on the variable.

Test yourself on Concurrency basics

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

Start free test
All Concurrency basics questions →