Java Number doubleValue() Method

The doubleValue() is a method of Java Number class which returns the value of the specified number casted as a double equivalent. This method may also involve in rounding or truncation.

Syntax:

Following is the declaration of doubleValue() method:

Parameter:

DataTypeParameterDescription
NANAThis method does not accept any parameter.

Returns:

The doubleValue() method returns the numeric value represented by this object after conversion to type double.

Exceptions:

NA

Compatibility Version:

Java 1.0 and above

Example 1

Test it Now

Output:

x as integer : 123456
x as double: 123456.0

Example 2

Output:

Enter the Desired Value : 987654321
Double Value is: 9.87654321E8

Example 3

Test it Now

Output:

1.234567898E9
9.34545856E8
53454.43654
7.3454587659675456E16