volatile alone makes count++ atomic.
Practice this question from Quiz: Java Concurrency, with options and an explanation.
Question
volatile alone makes count++ atomic.
Option A
True
volatile helps threads see fresh values but does not make compound actions atomic.
Option B — Correct answer
False
volatile helps threads see fresh values but does not make compound actions atomic.