Last active
December 12, 2015 09:49
-
-
Save gvsmirnov/4754061 to your computer and use it in GitHub Desktop.
Does JMM guarantee that the assertion passes?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ValueHolder { | |
int first; | |
final int second; | |
ValueHolder(int first) { | |
this.first = first; | |
this.second = this.first; | |
} | |
} | |
//Thread 1 | |
value = new ValueHolder(4); | |
//Thread 2 | |
assert value.first == 4; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment