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