Within a single thread, the JVM obeys 'as-if-serial' execution—allowing javac, the JIT compiler, and CPU hardware to reorder independent reads and writes freely. Across threads without synchronization, those optimizations make writes arrive late or visibly out-of-order unless a happens-before relationship connects them.
More lessons in Complete Core Java