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 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 Date toString() method in Java with Examples The toString() method of Java Date class converts this date object into a String in form "dow mon dd hh:mm:ss zzz yyy". This method overrides toString in class object. Syntax: public String toString() Parameters: The function does not accept any parameter. Return Value: It method returns a string re 2 min read Duration toString() method in Java with Examples The toString() method of Duration Class in java.time package is used to get the String value of this duration. This String is in the ISO-8601 format. Syntax: public String toString() Parameters: This method do not accepts any parameter. Return Value: This method returns a String value which is the S 1 min read Byte toString() method in Java with examples The toString() method of Byte class is a built in method in Java which is used to return a String value. public String toString() Syntax: ByteObject.toString() Return Value: It returns a String object, the value of which is equal to the value of the ByteObject. Below is the implementation of toStrin 2 min read AtomicReferenceArray toString() method in Java with Examples The toString() method of a AtomicReferenceArray class is used to return the String representation of the current values of array.This method is used to represent the contents of AtomicReferenceArray as string Syntax: public String toString() Parameters: This method accepts nothing. Return value: Thi 2 min read BitSet toString() Method in Java with Examples The java.util.BitSet.toString() is an inbuilt method of BitSet class that is used to get a string representation of the bits of the sets in the form of a set of entries separated by â, â. So basically the toString() method is used to convert all the elements of BitSet into String. In addition to thi 2 min read Like