Are array members treated with volatile style semantics?
Java does not have a way to declare array members as volatile so is the compiler allowed to make a working copy of an array member? (JLS seems to say yes.) And if so, does the copy have to be reconciled on every reference as a volatile variable does? (JLS seems to say no.)
In the code below, an array member is changed by another
thread. Is that change visible in the main thread?
From my reading of the JLS I believe that the only way to ensure that working copies of array members are reconciled is to use locking. This would mean that my example is incorrectly coded and would (probably) loop forever.
I understand how to fix the example but I would like to find out if I am understanding what the JLS is telling me. Any comments?