Java memory model: volatile variables and happens-before
问题 I'd like to clarify how happens-before relation works with volatile variables. Let we have the following variables: public static int i, iDst, vDst; public static volatile int v; and thread A: i = 1; v = 2; and thread B: vDst = v; iDst = i; Are the following statements correct in accordance with Java memory model (JMM)? If not, what would be correct interpretation? i = 1 always happens-before v = 2 v = 2 happens-before vDst = v in JMM only if it's actually happens before in time i = 1 happens