Java API Tutorial - Java AtomicBoolean(boolean initialValue) Constructor








Syntax

AtomicBoolean(boolean initialValue) constructor from AtomicBoolean has the following syntax.

public AtomicBoolean(boolean initialValue)

Example

In the following code shows how to use AtomicBoolean.AtomicBoolean(boolean initialValue) constructor.

/*from  ww w .j a  v  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(true);
    
    System.out.println(atomicBoolean);
  }
}

The code above generates the following result.