Number doubleValue() in Java

doubleValue(): This method is available in java.lang.Number class of Java.

Syntax:

double java.lang.Number.doubleValue()

This method returns the value of the specified number as a double.

Parameters: NA

Returns: the numeric value represented by this object after conversion to type double.

Exceptions: NA

For Example:

Number number = 1234

number.doubleValue() = > It returns 1234.0

Approach

Java

public class NumberdoubleValue {
    public static void main(String[] args) {

        Number number = 1234;

        System.out.println(number.doubleValue());
    }
}

Output:

1234.0

No comments:

Post a Comment