AtomicBoolean.set(boolean newValue) has the following syntax.
public final void set(boolean newValue)
In the following code shows how to use AtomicBoolean.set(boolean newValue) method.
//from www. j av a 2 s . c om import java.util.concurrent.atomic.AtomicBoolean; public class Main { public static void main(String[] argv) throws Exception { AtomicBoolean atomicBoolean = new AtomicBoolean(); atomicBoolean.set(true); System.out.println(atomicBoolean); } }
The code above generates the following result.