Java AtomicInteger.longValue()

Syntax

AtomicInteger.longValue() has the following syntax.

public long longValue()

Example

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


import java.util.concurrent.atomic.AtomicInteger;
/*from   www .j  ava  2  s  .com*/
public class Main {
  public static void main(String[] argv) throws Exception {
    AtomicInteger atomicInteger = new AtomicInteger();
    
    atomicInteger.set(2);
    
    System.out.println(atomicInteger.longValue());
  }
}

The code above generates the following result.





















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




AtomicBoolean
AtomicInteger
AtomicIntegerArray
AtomicLong
AtomicLongArray