Generate UUID in Java

Generate UUID in Java

To Generate UUID in Java

1
2
3
4
5
6
7
8
import java.util.UUID;

public class UUIDGenerator {
public static void main(String[] args) {
UUID uuid = UUID.randomUUID();
System.out.println(uuid.toString());
}
}

Sample output

1
a76e2a77-3d81-4bde-8116-1c4c87fe7613