Java.lang.Double.toString() Method
Advertisements
Description
The java.lang.Double.toString(double d) method returns a string representation of the double argument.The argument d is the double value to be converted.
Declaration
Following is the declaration for java.lang.Double.toString() method
public static String toString(double d)
Parameters
d -- This is the double to be converted.
Return Value
This method returns a String representation of the argument.
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 d1 = new Double("9.7");
// returns a string representation of the double argument
String retval = Double.toString(d1);
System.out.println("Value = " + retval);
}
}
Let us compile and run the above program, this will produce the following result:
Value = 9.7