Java API Tutorial - Java AtomicLong.floatValue()








Syntax

AtomicLong.floatValue() has the following syntax.

public float floatValue()

Example

In the following code shows how to use AtomicLong.floatValue() method.

// w w w.  j a v  a  2s . c  o  m
import java.util.concurrent.atomic.AtomicLong;

public class Main {
  public static void main(String[] argv) {
    AtomicLong nextId = new AtomicLong();

    System.out.println(nextId.getAndIncrement());
    System.out.println(nextId.floatValue());
  }
}

The code above generates the following result.