Skip to content

Instantly share code, notes, and snippets.

@gauravkukade
Created December 23, 2020 17:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gauravkukade/395f314c549969bd300d72c7e032dbcb to your computer and use it in GitHub Desktop.
Save gauravkukade/395f314c549969bd300d72c7e032dbcb to your computer and use it in GitHub Desktop.
A Java program to create a Randomly Generated UUID i.e. Version 4 UUID. Read blog at coderolls.com/create-uuid-in-java
import java.util.UUID;
/**
* A Java program to create a Randomly Generated UUID i.e. Version 4 UUID
* @author Gaurav Kukade at coderolls.com
*
*/
public class CreateUUID {
public static void main(String[] args) {
// creating random uuid i.e. version 4 UUID
UUID uuid = UUID.randomUUID();
System.out.println("Printing the randomly generated UUID value......\n");
System.out.println("uuid: "+uuid);
}
}
@gauravkukade
Copy link
Author

Output:

Printing the randomly generated UUID value......

uuid: e3aed661-ccc2-42fd-ad69-734fee350cd2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment