Short intValue() in Java

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

Syntax:

int java.lang.Short.intValue()

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

Parameters: NA

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

Exceptions: NA

Approach

Java

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

        Short short1 = 1;

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

Output:

1

No comments:

Post a Comment