0

What is "Atomic integer" in java?

private static final AtomicInteger i = new AtomicInteger(1);

20th Jun 2018, 10:49 AM
Star Lord
Star Lord - avatar
1 Resposta
+ 1
It allows you to use Atomic operations. If you have multi threading application than simple increment like i++ may end with wrong result. That's why it's better to use atomic operations.
20th Jun 2018, 11:29 AM
Lstiti