What is "Atomic integer" in java? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
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 Antwort
+ 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