Short floatValue() in Java

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

Syntax:

float java.lang.Short.floatValue()

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

Parameters: NA

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

Exceptions: NA

Approach

Java

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

        Short short1 = 1;

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

Output:

1.0


No comments:

Post a Comment