在 Java 中创建 GUID [英] Create a GUID in Java

查看:35
本文介绍了在 Java 中创建 GUID的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在 Java 中创建 GUID 的最佳方法有哪些?

What are some of the best ways to create a GUID in Java?

推荐答案

查看UUID 类 与 Java 5 及更高版本捆绑在一起.

Have a look at the UUID class bundled with Java 5 and later.

例如:

  • If you want a random UUID you can use the randomUUID method.
  • If you want a UUID initialized to a specific value you can use the UUID constructor or the fromString method.

这篇关于在 Java 中创建 GUID的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆