Skip to content
Sharp

Concurrency basics · interview question

Which class would you use for an atomic counter in Java?

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

Correct answer

A. AtomicInteger

Why

AtomicInteger is a class that provides atomic operations on an integer value, making it ideal for counters in concurrent applications.

Test yourself on Concurrency basics

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

Start free test
All Concurrency basics questions →