Java AtomicInteger(int initialValue) Constructor
Syntax
AtomicInteger(int initialValue) constructor from AtomicInteger has the following syntax.
public AtomicInteger(int initialValue)
Example
In the following code shows how to use AtomicInteger.AtomicInteger(int initialValue) constructor.
import java.util.concurrent.atomic.AtomicInteger;
/* w ww . j a va 2 s. co m*/
public class Main {
public static void main(String[] argv) throws Exception {
AtomicInteger atomicInteger = new AtomicInteger(20);
System.out.println(atomicInteger.get());
}
}
The code above generates the following result.