双类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()方法与示例相关推荐

  1. java long short_Java Long类shortValue()方法与示例

    Long类shortValue()方法shortValue()方法在java.lang包中可用. shortValue()方法用于返回由此Long对象表示的值,该对象转换为short类型(通过强制转换 ...

  2. java中double..compare_Java Double类compare()方法与示例

    Double类compare()法compare()方法在java.lang包中可用. compare()方法用于检查给定两个双精度值的相等或不相等,换句话说,可以说此方法用于比较两个双精度值. co ...

  3. java annotation class,Java Class类 isAnnotation()方法及示例

    Class类isAnnotation()方法isAnnotation()方法在java.lang包中可用. isAnnotation()方法用于检查此Class对象是否表示注释类型. isAnnota ...

  4. java字符类型的返回值,Java字符类isWhitespace()方法及示例

    Character 类isWhitespace()法isWhitespace()方法在java.lang包中可用. isWhitespace()方法用于检查给定的char值是否为空格,但是它包含空格中 ...

  5. Java Integer类shortValue()方法与示例

    整数类shortValue()方法 (Integer class shortValue() method) shortValue() method is available in java.lang ...

  6. Java Double类parseDouble()方法的示例

    Double类parseDouble()方法 (Double class parseDouble() method) parseDouble() method is available in java ...

  7. Java Double类doubleToLongBits()方法与示例

    Double类doubleToLongBits()方法 (Double class doubleToLongBits() method) doubleToLongBits() method is av ...

  8. Java Long类shortValue()方法与示例

    长类shortValue()方法 (Long class shortValue() method) shortValue() method is available in java.lang pack ...

  9. java日历类add方法_Java日历computeTime()方法及示例

    java日历类add方法 日历类computeTime()方法 (Calendar Class computeTime() method) computeTime() method is availa ...

最新文章

  1. LTE基带芯片出货量首次超过50%
  2. 深入剖析iLBC的丢包补偿技术(PLC)
  3. 浅析商城网站建设需要注意哪些细节内容呢?
  4. 多元经验模态分解_环境激励桥梁模态参数识别—环境激励模态参数识别概述
  5. [云炬创业基础笔记]第十一章创业计划书测试6
  6. 开发中的问题——环境相关
  7. 在Eclipse中用Maven打包jar包--完整版
  8. 02-大鸭梨博客系统数据库设计及Dapper的使用
  9. CF #738(div2)B. Mocha and Red and Blue(构造)
  10. [XHTML Tutorial] 走向XHTML标准 (4)(XHTML Syntax)
  11. 等保二级与等保三级的四大区别分析-行云管家
  12. JDBC的批处理和事务
  13. android uri parcel,Android Intent 使用 Parcel 反序列化出错.
  14. mysql 从大到小排序
  15. 黄油刀 Butterknife的使用准备工作
  16. 支付宝开通海外退税 阿里腾讯暗战跨境O2O_21世纪网
  17. 蠎周刊 188: Jays
  18. 计算机意外重启或错误,Win7系统安装提示计算机意外重启或遇到错误解决方案...
  19. 当我跑步时,我在想什么
  20. 强强合作,替代钉盘/微盘,企业实现低成本扩容

热门文章

  1. 鸿蒙系统替代iOS,华为横空出世!鸿蒙系统,能否替代安卓IOS?
  2. 完成数独的算法 python_python实现数独算法实例
  3. linux用rsync实现同步,Linux下使用rsync实现主备机代码同步
  4. TensorFlow实验(3)
  5. Python二级笔记(16)
  6. awk教程入门与实例练习(三)
  7. leetcode 121 股票买卖问题系列
  8. 2017 Google 开发者大会直播入口
  9. (转)Redis研究(一)—简介
  10. Sql Server中自动序号的方法