?
, . .
, b, c?
. dcastro, . , , :
synchronized (lock){
a = 5;
b = 5;
c = 5;
}
, . , :
synchronized (lock){
c = 5;
b = 5;
a = 5;
}
, - , JVM ?
, , , Java. Java , . , . , , §17.4.5 Java:
, . , .
In other words: if you completely ignore reordering and for all possible program executions, there is no way for two threads to access the same memory location, which is neither mutable nor atomic, and at least one of the actions is a write operation, then all performances will be displayed as if there were no changes.
In short: Avoid data investigations and you will never see reordering.
nosid source
share