Java UUID - toString() Method
The java.util.UUID.toString() method returns a String object representing this UUID.
Syntax
public String toString()
Parameters
No parameter is required.
Return Value
Returns a string representation of this UUID.
Exception
NA.
Example:
In the example below, the java.util.UUID.toString() method returns a String object representing the given UUID.
import java.util.*; public class MyClass { public static void main(String[] args) { //creating an UUID UUID uid = UUID.fromString("d81e4f2e-cdf2-10e6-529b-7df92533d1cb"); //printing the string representation of the uuid System.out.println("String Value: " + uid.toString()); } }
The output of the above code will be:
String Value: d81e4f2e-cdf2-10e6-529b-7df92533d1cb
❮ Java.util - UUID