Java UUID.toString()

Syntax

UUID.toString() has the following syntax.

public String toString()

Example

In the following code shows how to use UUID.toString() method.


// ww w .  jav a  2  s.  c o m
import java.util.UUID;

public class Main {
   public static void main(String[] args) {
      // creating UUID      
      UUID uid = UUID.randomUUID();     
        
      // checking string representation
      System.out.println("String value: "+uid.toString());    
   }    
}

The code above generates the following result.