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.


//  ww w .  j  ava  2  s . c o  m
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.





















Home »
  Java Tutorial »
    java.util.concurrent.atomic »




AtomicBoolean
AtomicInteger
AtomicIntegerArray
AtomicLong
AtomicLongArray