Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardKotlinVolatile and atomics on JVMSingle-choice MCQ

Given the snippet, two threads run `inc()` concurrently 1,000 times each. What is the most precise statement about the final value of `counter`?

class Counter { @Volatile var counter = 0 fun inc() { counter++ } }