Skip to content
Sharp

Concurrency basics · interview question

Why do teams use AtomicInteger over a synchronized block in production code?

Multiple choiceEasychapter-15-curatedpremiumconcurrencyatomic-variables
Choose one answer
Answer and explanation

Correct answer

B. Avoids thread blocking

Why

AtomicInteger uses lock-free, non-blocking algorithms that leverage hardware-level support, avoiding the overhead associated with thread blocking in synchronized blocks.

Test yourself on Concurrency basics

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

Start free test
All Concurrency basics questions →