Java AtomicInteger.addAndGet(int delta)

Syntax

AtomicInteger.addAndGet(int delta) has the following syntax.

public final int addAndGet(int delta)

Example

In the following code shows how to use AtomicInteger.addAndGet(int delta) method.


/* w  ww.  ja v a 2  s .c om*/
import java.util.concurrent.atomic.AtomicInteger;

public class Main {
  public static void main(String[] argv) throws Exception {
    AtomicInteger atomicInteger = new AtomicInteger();
    atomicInteger.addAndGet(10);
    System.out.println(atomicInteger.get());
  }
}

The code above generates the following result.





















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




AtomicBoolean
AtomicInteger
AtomicIntegerArray
AtomicLong
AtomicLongArray