AtomicInteger toString() method in Java with examples Last Updated : 29 Jan, 2019 Comments Improve Suggest changes Like Article Like Report The java.util.concurrent.atomic.AtomicInteger.toString() is an inbuilt method in java that returns the string representation of the current value which is been stored in the integer. Syntax: public String toString() Parameters: The function does not accepts any parameter. Return value: The function returns the string representation of the current value. Program below demonstrates the function: Program 1: Java // Java program that demonstrates // the toString() 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); System.out.println("Previous value: " + val); String s = val.toString(); // Prints the string value System.out.println("String value: " + s); } } Output: Previous value: 0 String value: 0 Program 2: Java // Java program that demonstrates // the toString() 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); System.out.println("Previous value: " + val); String s = val.toString(); // Prints the string value System.out.println("String value: " + s); } } Output: Previous value: 18 String value: 18 Reference: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/atomic/AtomicInteger.html#toString-- Comment More infoAdvertise with us Next Article AtomicInteger toString() method in Java with examples G gopaldave Follow Improve Article Tags : Java Java - util package Java-Functions Java-AtomicInteger Practice Tags : Java Similar Reads AtomicIntegerArray toString() method in Java with Examples The Java.util.concurrent.atomic.AtomicIntegerArray.toString() is an inbuilt method in Java that returns a string that textually represents the current values of the AtomicIntegerArray. The resulting string is a concise and informative representation that is easy for a person to read. It is used to e 2 min read AtomicLong toString() method in Java with examples The Java.util.concurrent.atomic.AtomicLong.toString() is an inbuilt method in java that returns the string representation of the current value which is been stored in the AtomicLong. Syntax: public String toString() Parameters: The function does not accepts any parameter. Return value: The function 1 min read AtomicReference toString() method in Java with Examples The toString() method of a AtomicReference class is used to return the String representation of the current value of AtomicReference object. Syntax: public String toString() Parameters: This method accepts nothing. Return value: This method returns the String representation of the current value. Bel 1 min read AtomicLongArray toString() method in Java with Examples The Java.util.concurrent.atomic.AtomicLongArray.toString() is an inbuilt method in Java that returns a string that textually represents the current values of the AtomicLongArray. The resulting string is a concise and informative representation that is easy for a person to read. It is used to easily 2 min read AtomicBoolean toString() method in Java with Examples The java.util.concurrent.atomic.AtomicBoolean.toString() is an inbuilt method in java that returns the string representation of the current value which is been stored in the boolean. Syntax: public String toString() Parameters: The function does not accepts any parameter. Return Value: The function 1 min read Like