AtomicInteger intValue() method in Java with examples Last Updated : 29 Jan, 2019 Comments Improve Suggest changes Like Article Like Report The java.util.concurrent.atomic.AtomicInteger.intValue() is an inbuilt method in java that returns the value which is currently stored in the object which is of data-type int. Syntax: public int intValue() Parameters: The function does not accepts a single parameter. Return value: The function returns the current value. Program below demonstrates the function: Program 1: Java // Java program that demonstrates // the intValue() function import java.util.concurrent.atomic.AtomicInteger; public class GFG { public static void main(String args[]) { // Initially value as 0 AtomicInteger val = new AtomicInteger(0); int res = val.intValue(); // Prints the updated value System.out.println("Current value: " + res); } } Output: Current value: 0 Program 2: Java // Java program that demonstrates // the intValue() function import java.util.concurrent.atomic.AtomicInteger; public class GFG { public static void main(String args[]) { // Initially value as 18 AtomicInteger val = new AtomicInteger(18); int res = val.intValue(); // Prints the updated value System.out.println("Current value: " + res); } } Output: Current value: 18 Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicInteger.html#intValue-- Comment More infoAdvertise with us Next Article AtomicInteger intValue() method in Java with examples G gopaldave Follow Improve Article Tags : Java Java - util package Java-Functions Java-AtomicInteger Practice Tags : Java Similar Reads AtomicLong intValue() method in Java with examples The Java.util.concurrent.atomic.AtomicLong.intValue() is an inbuilt method in java that returns the value which is currently stored in the object which is of data-type long by doing a narrowing primitive conversion. Syntax: public long intValue() Parameters: The function does not accepts a single pa 1 min read AtomicInteger get() method in Java with examples The java.util.concurrent.atomic.AtomicInteger.get() is an inbuilt method in java which returns the current value which is of date-type int. Syntax: public final int get() Parameters: The function does not accepts any parameter. Return value: The function returns the current value Program below demon 1 min read AtomicInteger floatValue() method in Java with examples The java.util.concurrent.atomic.AtomicInteger.floatValue() is an inbuilt method in java which returns the current value of the AtomicInteger as a Float data-type after performing primitive conversion. Syntax: public float floatValue() Parameters: The function does not accepts any parameter. Return v 1 min read BigInteger intValueExact() Method in Java with Examples java.math.BigInteger.intValueExact() was introduced in Java 8. It is an inbuilt function which converts the value of BigInteger to a int and checks for lost information. If the value of BigInteger is greater than 2,147,483,647 or less than -2,147,483,648; the method will throw ArithmeticException as 3 min read AtomicInteger set() method in Java with examples The java.util.concurrent.atomic.AtomicInteger.set() is an inbuilt method in java that updates the previous value and sets it to a new value which is passed in the parameter. Syntax: public final void set(int newVal) Parameters: The function accepts a single mandatory parameter newVal which is to be 1 min read Like