Create a new UUID - Java java.util

Java examples for java.util:UUID

Description

Create a new UUID

Demo Code


//package com.java2s;
import java.util.UUID;

public class Main {
    public static void main(String[] argv) throws Exception {
        System.out.println(getUUID());
    }/*from w w w . jav a  2 s  . co m*/

    /**
     * Create a new UUID
     * @return the uuid as a string
     */
    public static String getUUID() {
        return UUID.randomUUID().toString();
    }
}

Related Tutorials