AtomicReference toString() method in Java with Examples Last Updated : 27 Dec, 2019 Summarize Comments Improve Suggest changes Share Like Article Like Report 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. Below programs illustrate the toString() method: Program 1: Java // Java program to demonstrate // AtomicReference.toString() method import java.util.concurrent.atomic.AtomicReference; public class GFG { public static void main(String[] args) { // create an atomic reference object. AtomicReference<Double> ref = new AtomicReference<Double>(); // set some value ref.set(1234.00); // apply toString() System.out.println("Value = " + ref.toString()); } } Output: Value = 1234.0 Program 2: Java // Java program to demonstrate // AtomicReference.toString() method import java.util.concurrent.atomic.AtomicReference; public class GFG { public static void main(String[] args) { // create an atomic reference object // which stores String. AtomicReference<String> ref = new AtomicReference<String>(); // set some value ref.set("GFG"); // apply toString() System.out.println("Value = " + ref.toString()); } } Output: Value = GFG References: https://docs.oracle.com/javase/10/docs/api/java/util/concurrent/atomic/AtomicReference.html#toString() Comment More infoAdvertise with us Next Article AtomicInteger toString() method in Java with examples A AmanSingh2210 Follow Improve Article Tags : Java Java-Functions Java-util-concurrent-atomic package Practice Tags : Java Similar Reads 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 AtomicInteger toString() method in Java with examples 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 1 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 Currency toString() Method in Java with Examples The toString() Method of Currency class in Java is used to retrieve the currency code of this currency which is actually the official ISO 4217 currency code in a string format Syntax: CURRENCY.toString() Parameters: This method does not accept any parameters. Return Value: This method returns the IS 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 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 Like