Java API Tutorial - Java AtomicIntegerArray .incrementAndGet (int i)








Syntax

AtomicIntegerArray.incrementAndGet(int i) has the following syntax.

public final int incrementAndGet(int i)

Example

In the following code shows how to use AtomicIntegerArray.incrementAndGet(int i) method.

/*from   w  w  w .j a  v a2 s  . c om*/
import java.util.concurrent.atomic.AtomicIntegerArray;

public class Main {
  public static void main(String[] argv) throws Exception {
    AtomicIntegerArray atomicIntegerArray = new AtomicIntegerArray(new int[]{0,1,2,3});
    
    atomicIntegerArray.incrementAndGet(0);
    
    System.out.println(atomicIntegerArray);
  }
}

The code above generates the following result.