java.util.UUID.toString() Method

Advertisements


Description

The toString() method is used to return a String object representing this UUID.

Declaration

Following is the declaration for java.util.UUID.toString() method.

public String toString()

Parameters

  • NA

Return Value

The method call returns a string representation of this UUID.

Exception

  • NA

Example

The following example shows the usage of java.util.UUID.toString()

package com.tutorialspoint;

import java.util.*;

public class UUIDDemo {
   public static void main(String[] args) {
      // creating UUID      
      UUID uid = UUID.fromString("38400000-8cf0-11bd-b23e-10b96e4ef00d");     
        
      // checking string representation
      System.out.println("String value: "+uid.toString());    
   }    
}

Let us compile and run the above program, this will produce the following result.

String value: 38400000-8cf0-11bd-b23e-10b96e4ef00d



Advertisements
Advertisements