Java.lang.Double.toString() Method

Advertisements


Description

The java.lang.Double.toString() method returns a string representation of this Double object.

Declaration

Following is the declaration for java.lang.Double.toString() method

public String toString()

Parameters

  • NA

Return Value

This method returns a String representation of this object.

Exception

  • NA

Example

The following example shows the usage of java.lang.Double.toString() method.

package com.tutorialspoint;

import java.lang.*;

public class DoubleDemo {

   public static void main(String[] args) {

     Double d = new Double("5.3");
   
     // returns a string representation
     String retval = d.toString();
     System.out.println("Value = " + retval);
   }
}  

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

Value = 5.3



Advertisements
Advertisements