Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardJavaJMM happens-beforeSingle-choice MCQ

Two threads run the code below with `x` and `y` initially 0. Under the Java Memory Model, is the outcome r1 == 0 AND r2 == 0 permitted?

// Thread 1 // Thread 2 r1 = x; r2 = y; y = 1; x = 1;