Short shortValue() in Java

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

Syntax:

short java.lang.Short.shortValue()

This method returns the value of this Short as a short.

Parameters: NA

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

Exceptions: NA

Approach

Java

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

        Short short1 = 1;

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

Output:

1

No comments:

Post a Comment