The use of UUID in JAVA

UUID is simply a 32-bit length string that never repeats, (but it is 36 bits in java, because it adds 4 '-'. So pay attention when setting the length in the database.)
The role of UUID is generally a unique identifier, which is mainly used as a unique primary key for the database.

Its use is very simple, the code is given below:

package ziyang;

import java.util.UUID;

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

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325819124&siteId=291194637