What is a race condition, and what tools does Java give you to protect against it?
~4 min by voice
How to approach it
The interviewer wants to see whether you understand where multithreading problems come from: non-atomic operations and invisible changes. It also matters whether you can tell the protection tools apart: synchronized gives mutual exclusion and visibility, volatile gives only visibility, and the Atomic classes give atomic operations without locks.
The interviewer will ask this question and listen. Think out loud and ask for a hint if you need one. When you're done, pause or tap “That's my answer”. In about a minute, your score and the points you covered show up here.