, , enum , , , , Java, , ,
Java
( , enum, ),
.
, OP volatile (, final):
volatile int letter;
In more complex cases, such as the increment or the other (very unlikely to transfers, but ... who knows installer transfers itself is exotic), other weapons of parallelism, such as blocks Atomic, synchronized, Lockmay be necessary.
In addition, there is a discussion of the security of enumerated streams.
source
share