I am doing as follows, there's only 2 threads in my program.
// Thread 1
write a = 0
write a = 1
write volatile b = 1
// Thread 2
read volatile b // this I always do after write volatile b in the 1st thread
read a
I've read on Java Memory Model and from what I understand in thread 2 read a
will ALWAYS give me 1.
I would like to know if this my understanding is correct or not.
In particular CAN A REORDERING still HAPPEN so I see a = 0 in the 2nd thread?