Java Data Type Tutorial - 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.

/*w ww .  j av  a2 s .co  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.