Atomic operations are performed in a single task unit without interfering with other operations. In multi-threaded environments, atomic operations are required to avoid data inconsistencies. int is not an atomic operation. So, when one thread reads this value and increments it by one, the other thread reads the original value, resulting in an incorrect result.   To solve this problem, we need to make sure that the number of sum operations is atomic. We can do this using synchronization, but java.util.concurrent.atomic in Java 5 provides wrapper classes for int and long that can be used to achieve this. atomically without synchronization.