Java Double shortValue() MethodThe 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 1Output: 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 2Output: Enter a number = 987654.987 1. Short value =4614 2. Long value =987654 3. Byte value =6 Next TopicJava-double-sum-method |
We provides tutorials and interview questions of all technology like java tutorial, android, java frameworks
G-13, 2nd Floor, Sec-3, Noida, UP, 201301, India