Java AtomicInteger() Constructor

Syntax

AtomicInteger() constructor from AtomicInteger has the following syntax.

public AtomicInteger()

Example

In the following code shows how to use AtomicInteger.AtomicInteger() constructor.


import java.util.concurrent.atomic.AtomicInteger;
/*  w ww  .j a va2 s  .  com*/
public class Main {
  public static void main(String[] argv) throws Exception {
    AtomicInteger atomicInteger = new AtomicInteger();

    System.out.println(atomicInteger.get());
  }
}

The code above generates the following result.





















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




AtomicBoolean
AtomicInteger
AtomicIntegerArray
AtomicLong
AtomicLongArray