The shortValue() is an inbuilt method of the Short class in Java and is used to return the Short value of
this value.
Syntax:
public short shortValue()
Parameters: The method does not take any parameter.
Return Value: The method returns the numeric value represented by this object after conversion to type short.
Below programs illustrate the Short.shortValue() method:
Program 1:
Output:
The short value of the given Short is = 21
Program 2:
Output:
The short value of the given Short is = -19
Program 3:
Note: It returns an error message when a decimal value and string is passed as an argument.