Short doubleValue() in Java

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

Syntax:

double java.lang.Short.doubleValue()

This method returns the value of this Short as a double after a widening primitive conversion.

Parameters: NA

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

Exceptions: NA

Approach

Java

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

        Short short1 = 1;

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

Output:

1.0

No comments:

Post a Comment