Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.atomic.AtomicInteger; public class AtomicIntegerGetAndIncrementExp4 { public static void main(String[] args) { AtomicInteger value = new AtomicInteger(-1); int value1 = value.getAndIncrement(); System.out.println("the updated number: " +value); System.out.println("the previous number: " +value1); } }
Output