Short longValue() in Java

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

Syntax:

long java.lang.Short.longValue()

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

Parameters: NA

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

Exceptions: NA

Approach

Java

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

        Short short1 = 1;

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

Output:

1

No comments:

Post a Comment