Java / Java Multithreading
Is ++ (increment) operator thread-safe in Java?
No. Neither increment operator (++) nor the decrement operaor (--) is thread safe.
For example, the statement i++ is not atomic. It involves multiple instructions that includes reading the value of i variable, increment its value by 1 and store the new i value to the variable.
More Related questions...