Online Java Compiler By
JavaTpoint.com
import java.util.concurrent.atomic.AtomicLong; public class AtomicLongWeakCompareAndSetExample2 { public static void main (String [] args) { AtomicLong atomiclong = new AtomicLong(); long expectedValue = 222; long newValue = 111; atomiclong.weakCompareAndSet(expectedValue, newValue); //Since Initialized value and expected value are not equal prints the Initialized value System.out.println(atomiclong); } }
Output