UUID version() Method in Java with Examples
Every UUID has a version number describing the generation of this UUID. The version() method of UUID class in Java is generally used to get version number associated with this UUID.
Attention reader! Don’t stop learning now. Get hold of all the important Java Foundation and Collections concepts with the Fundamentals of Java and Java Collections Course at a student-friendly price and become industry ready. To complete your preparation from learning a language to DS Algo and many more, please refer Complete Interview Preparation Course.
public int version()
Parameters: This method does not take any parameter.
Return Value: This method returns a int value which is the version number associated with this UUID.
Below programs illustrate the working of version() method:
UUID: 58e0a7d7-eebc-11d8-9669-0800200c9a66 The version number is: 1
UUID: 5fc03087-d265-11e7-b8c6-83e29cd24f4c The version number is: 1