Java Data Type Tutorial - Java UUID.fromString(String name)








Syntax

UUID.fromString(String name) has the following syntax.

public static UUID fromString(String name)

Example

In the following code shows how to use UUID.fromString(String name) method.

//from  w w  w  .  j av a  2 s . c om


import java.util.UUID;

public class Main {
   public static void main(String[] args) {
      // creating UUID      
      UUID x = UUID.fromString("00000000-00000-0000-0000-0000000000000");
           
        
      // checking UUID value
      System.out.println("UUID value is: "+x);    
   }    
}

The code above generates the following result.