Java Long shortValue() method example

HQ » Java Tutorial » java.lang » Long » shortValue()
Java Long shortValue() method example 2018-02-16T07:26:11+00:00

java.lang.Long shortValue()

Description

The shortValue() java method of Long class returns the value of this Long as a short after a narrowing primitive conversion.

Notes:

  • Overrides shortValue in class Number

Method Syntax

public static int shortValue()

Method Argument

Data Type Parameter Description
N/A N/A N/A

Method Returns

The shortValue() method of Long class returns the numeric value represented by this object after conversion to type short.

Compatibility

Requires Java 1.0 and up

Java Long shortValue() Example

Below is a simple java example on the usage of shortValue() method of Long class.

Sample Output

Below is the sample output when you run the above example.

Java Long shortValue() example output

Contact Info

Singapore

Our Goal

JavaTutorialHQ aims to to be The Ultimate Guide on Java with hundreds of examples from basic to advance Topics.

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close