Javatpoint Logo
Javatpoint Logo

Java Double shortValue() Method

The shortValue() method of Double class returns the value of this object as a short after narrowing the primitive values or by casting to type short.

Syntax:

Parameters:

NA

Override:

The shortValue() method of Double class overrides the shortValue in class Number.

Return Value:

The shortValue() method returns the double value corresponding to this Double which has been converted to type short.

Example 1

Test it Now

Output:

1. 1240.7458 after converted to short Value = 1240
2. -1140.728 after converted to short Value = -1140
3. 7.46587634444444E8 after converted to short Value = 1522
4. 0.746587634 after converted to short Value = 0

Example 2

Output:

Enter a number = 987654.987
1. Short value =4614
2. Long value =987654
3. Byte value =6

Next TopicJava Double





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA