UUID: randomUUID()

UUID represents an immutable universally unique identifier (UUID). A UUID has a 128-bit value.


import java.util.UUID;

public class Main {
  public static void main(String arg[]) {
    System.out.println(UUID.randomUUID());
  }
}

Output:


138a4222-e898-484f-8347-dafc01c5b03b
Home 
  Java Book 
    Essential Classes