Java UUID.hashCode()

Syntax

UUID.hashCode() has the following syntax.

public int hashCode()

Example

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


//from ww  w  . j  a  v 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 hash code value
      System.out.println("Hash code value: "+uid.hashCode());    
   }    
}

The code above generates the following result.