Java interview questions — 11 years experience

These are the questions a candidate with 11 years of experience gets asked. The same question is asked at many levels — what changes is how deep the follow-ups go, so read section 3 of each entry.

  • What does volatile guarantee, and what does it not?

    volatile guarantees visibility and ordering: a write is seen by any later read, and operations are not reordered across it. It never guarantees atomicity, so volatile count++ still loses updates — it is three operations, and volatile makes each of them visible without making the trio indivisible.

    Asked constantlyintermediate1–12 yrs12 min readConcurrency

Other experience levels