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  . j  a  v  a2s . co m*/

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.