Java AtomicBoolean.set(boolean newValue)
Syntax
AtomicBoolean.set(boolean newValue) has the following syntax.
public final void set(boolean newValue)
Example
In the following code shows how to use AtomicBoolean.set(boolean newValue) method.
/* w w w . j a v a 2 s . co m*/
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.