The toString() method is used to return a String object representing this UUID.
Following is the declaration for java.util.UUID.toString() method.
public String toString()
NA
The method call returns a string representation of this UUID.
NA
The following example shows the usage of java.util.UUID.toString()
package com.tutorialspoint; import java.util.*; public class UUIDDemo { public static void main(String[] args) { // creating UUID UUID uid = UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d"); // checking string representation System.out.println("String value: "+uid.toString()); } }
Let us compile and run the above program, this will produce the following result.
String value: 38400000-8cf0-11bd-b23e-10b96e4ef00d