Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.atomic.AtomicLong; public class AtomicLongGetAndIncrementExample1 { public static void main (String [] args) { AtomicLong atomiclong = new AtomicLong(); //Sets the Initialized value Long result = atomiclong.getAndIncrement(); //Prints the Initialized value System.out.println("Initialized Value :" + result); //Increases the Initialized value by 1 System.out.println("Incremented Value: " + atomiclong.getAndIncrement()); } }
Output