generate random id in java code example
Example 1: java generate random id
String id = UUID.randomUUID().toString();
Example 2: how to generate random id in java
import java.util.UUID;
public class UUIDExample.
{
public static void main(String[] args)
{
UUID uuid=UUID.randomUUID(); //Generates random UUID.
System.out.println(uuid);
}
}