Java Double类shortValue()方法与示例
双类shortValue()方法 (Double class shortValue() method)
shortValue() method is available in java.lang package.
shortValue()方法在java.lang包中可用。
shortValue() method is used to return the value denoted by this Double object converted to type short (by casting).
shortValue()方法用于返回此Double对象表示的值,该值转换为short类型(通过强制转换)。
shortValue() method is a non-static method, it is accessible with the class object only and if we try to access the method with class name then we will get an error.
shortValue()方法是一种非静态方法,只能通过类对象访问,如果尝试使用类名访问该方法,则会收到错误消息。
shortValue() method does not throw an exception at the time of conversion from double to short.
在从double转换为short时, shortValue()方法不会引发异常。
Syntax:
句法:
public short shortValue();
Parameter(s):
参数:
It does not accept any parameter.
它不接受任何参数。
Return value:
返回值:
The return type of this method is short, it returns a converted (from type double to short) value represented by this Double object.
此方法的返回类型为short ,它返回由此Double对象表示的转换后的值(从double类型转换为short类型)。
Example:
例:
// Java program to demonstrate the example
// of shortValue() method of Double class
public class ShortValueOfDoubleClass {public static void main(String[] args) {// Variables initialization
double d1 = 18.20;
double d2 = 19.20;
// It returns double value denoted by this Double value1 object
// and converted to a short by calling value1.shortValue()
Double value1 = new Double(d1);
// Display value1 result
System.out.println("value1.shortValue(): " + value1.shortValue());
// It returns double value denoted by this Double value2 object
// and converted to a short by calling value2.shortValue()
Double value2 = new Double(d2);
// Display value2 result
System.out.println("value2.shortValue(): " + value2.shortValue());
}
}
Output
输出量
value1.shortValue(): 18
value2.shortValue(): 19
翻译自: https://www.includehelp.com/java/double-class-shortvalue-method-with-example.aspx
Java Double类shortValue()方法与示例相关推荐
- java long short_Java Long类shortValue()方法与示例
Long类shortValue()方法shortValue()方法在java.lang包中可用. shortValue()方法用于返回由此Long对象表示的值,该对象转换为short类型(通过强制转换 ...
- java中double..compare_Java Double类compare()方法与示例
Double类compare()法compare()方法在java.lang包中可用. compare()方法用于检查给定两个双精度值的相等或不相等,换句话说,可以说此方法用于比较两个双精度值. co ...
- java annotation class,Java Class类 isAnnotation()方法及示例
Class类isAnnotation()方法isAnnotation()方法在java.lang包中可用. isAnnotation()方法用于检查此Class对象是否表示注释类型. isAnnota ...
- java字符类型的返回值,Java字符类isWhitespace()方法及示例
Character 类isWhitespace()法isWhitespace()方法在java.lang包中可用. isWhitespace()方法用于检查给定的char值是否为空格,但是它包含空格中 ...
- Java Integer类shortValue()方法与示例
整数类shortValue()方法 (Integer class shortValue() method) shortValue() method is available in java.lang ...
- Java Double类parseDouble()方法的示例
Double类parseDouble()方法 (Double class parseDouble() method) parseDouble() method is available in java ...
- Java Double类doubleToLongBits()方法与示例
Double类doubleToLongBits()方法 (Double class doubleToLongBits() method) doubleToLongBits() method is av ...
- Java Long类shortValue()方法与示例
长类shortValue()方法 (Long class shortValue() method) shortValue() method is available in java.lang pack ...
- java日历类add方法_Java日历computeTime()方法及示例
java日历类add方法 日历类computeTime()方法 (Calendar Class computeTime() method) computeTime() method is availa ...
最新文章
- LTE基带芯片出货量首次超过50%
- 深入剖析iLBC的丢包补偿技术(PLC)
- 浅析商城网站建设需要注意哪些细节内容呢?
- 多元经验模态分解_环境激励桥梁模态参数识别—环境激励模态参数识别概述
- [云炬创业基础笔记]第十一章创业计划书测试6
- 开发中的问题——环境相关
- 在Eclipse中用Maven打包jar包--完整版
- 02-大鸭梨博客系统数据库设计及Dapper的使用
- CF #738(div2)B. Mocha and Red and Blue(构造)
- [XHTML Tutorial] 走向XHTML标准 (4)(XHTML Syntax)
- 等保二级与等保三级的四大区别分析-行云管家
- JDBC的批处理和事务
- android uri parcel,Android Intent 使用 Parcel 反序列化出错.
- mysql 从大到小排序
- 黄油刀 Butterknife的使用准备工作
- 支付宝开通海外退税 阿里腾讯暗战跨境O2O_21世纪网
- 蠎周刊 188: Jays
- 计算机意外重启或错误,Win7系统安装提示计算机意外重启或遇到错误解决方案...
- 当我跑步时,我在想什么
- 强强合作,替代钉盘/微盘,企业实现低成本扩容