Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.atomic.AtomicLong; public class AtomicLongGetAndAddExample3 { public static void main (String [] args) { AtomicLong atomiclong = new AtomicLong(-5); //adds this number to the Initialized value Long result = atomiclong.getAndAdd(10); //Prints the added value before addition to the Initialized value System.out.println(result); } }
Output