UUID toString() Method in Java with Examples Last Updated : 27 Dec, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The toString() method of UUID class in Java is generally used to get the string representation of this UUID. Syntax: public String toString() Parameters: This method does not take any parameter. Return Value: This method returns a String value which is the string representation of this UUID. Below programs illustrate the working of toString() method: Program 1: Java // Java code to illustrate toString() method import java.util.*; public class UUID_Demo { public static void main(String[] args) { // Creating two UUIDs UUID UUID_1 = UUID .fromString( "58e0a7d7-eebc-11d8-9669-0800200c9a66"); // Displaying the UUID System.out.println("UUID: " + UUID_1); // Displaying the string representation System.out.println("The string representation is: " + UUID_1.toString()); } } Output: UUID: 58e0a7d7-eebc-11d8-9669-0800200c9a66 The string representation is: 58e0a7d7-eebc-11d8-9669-0800200c9a66 Program 2: Java // Java code to illustrate toString() method import java.util.*; public class UUID_Demo { public static void main(String[] args) { // Creating two UUIDs UUID UUID_1 = UUID .fromString( "5fc03087-d265-11e7-b8c6-83e29cd24f4c"); // Displaying the UUID System.out.println("UUID: " + UUID_1); // Displaying the toString Value System.out.println("The string representation is: " + UUID_1.toString()); } } Output: UUID: 5fc03087-d265-11e7-b8c6-83e29cd24f4c The string representation is: 5fc03087-d265-11e7-b8c6-83e29cd24f4c Comment More infoAdvertise with us Next Article Bidi toString() method in Java with Examples C chinmoy lenka Follow Improve Article Tags : Misc Java Java - util package Java-Functions Java-UUID +1 More Practice Tags : JavaMisc Similar Reads 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 Year toString() method in Java with Examples The toString() method of Year class in Java is used to return the string representation of this Year object. Syntax: public String toString() Parameter: This method does not accepts any parameter. Return Value: It returns the string representation of this Year object. Below programs illustrate the t 1 min read Bidi toString() method in Java with Examples The toString() method of java.text.Bidi class is used to display this Bidi instance in string representation. Syntax: public String toString() Parameter: This method accepts nothing as parameter. Return Value: This method display internal state of bidi in string format. Below are the examples to ill 2 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 Path toString() method in Java with Examples The Java Path interface was added to Java NIO in Java 7. toString() method of java.nio.file.Path used to return the string representation of this path. If this path was created by converting a path string using the getPath method then the path string returned by this method may differ from the origi 2 min read Class toString() method in Java with Examples The toString() method of java.lang.Class class is used to convert the instance of this Class to a string representation. This method returns the formed string representation. Syntax: public String toString() Parameter: This method does not accept any parameter. Return Value: This method returns the 1 min read Like