Java AtomicLong.set(long newValue)
Syntax
AtomicLong.set(long newValue) has the following syntax.
public final void set(long newValue)
Example
In the following code shows how to use AtomicLong.set(long newValue) method.
/* ww w. j av a2 s .c om*/
import java.util.concurrent.atomic.AtomicLong;
public class Main {
public static void main(String[] argv) {
AtomicLong nextId = new AtomicLong();
nextId.set(12312L);
System.out.println(nextId.longValue());
}
}
The code above generates the following result.