generate random id java code example
Example 1: java generate random id
String id = UUID.randomUUID().toString();
Example 2: java unique id
String uuid = UUID.randomUUID().toString();
Example 3: 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);
}
}