1

I am using JDK 11.0.2. What is the default UUID version if i do:

UUID.randomUUID();

Adding more details. By version i mean UUID v1 / UUID v2 / v3 / v4 etc..

user1354825
  • 1,108
  • 4
  • 21
  • 54
  • 3
    What do you mean with “*default* UUID version”? There is only one version number corresponding to “random”, [as documented](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/UUID.html#version()). It’s also mentioned in [the documentation of `randomUUID()`](https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/UUID.html#randomUUID()) itself, though it inconsistently calls it “type” rather than “version”. – Holger Nov 15 '21 at 14:47
  • The documentation provided by you points to Java 17. I was referring Java 11. – user1354825 Nov 16 '21 at 06:46
  • 5
    The UUID standard goes back to long before that. A random UUID is type 4. End of story. Not that it would matter in any circumstance. – Tim Roberts Nov 16 '21 at 06:50

1 Answers1

1

In addition to comments above, i also tried the version() method to get the uuid version. https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/UUID.html#version()

user1354825
  • 1,108
  • 4
  • 21
  • 54