Java Data Type Tutorial - Java UUID.version()








Syntax

UUID.version() has the following syntax.

public int version()

Example

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

// w  w w  .ja  va2 s. com

import java.util.UUID;

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

The code above generates the following result.