2 ms·
Thanks, that explains it! Didn't know that final fields have this special rule and that the value field in the String class is final. So to recap: this shouldn
by readittwice 9y ago
Thanks, that explains it! Didn't know that final fields have this special rule and that the value field in the String class is final.
So to recap: this shouldn't be possible for Strings, since the value field in the String class is final and therefore has a memory barrier. But it could happen for other classes with non-final fields.