Java中的Double到底是什么意思?

2022-01-17 00:00:00 floating-point numbers int double java

我对 Java 非常陌生,只是想确认一下 Double 是什么?它类似于 Float 还是 Int?任何帮助,将不胜感激.我有时也会看到大写的Double,有时会看到小写的double.如果有人能澄清这意味着什么,那就太好了!

I'm extremely new to Java and just wanted to confirm what Double is? Is it similar to Float or Int? Any help would be appreciated. I also sometimes see the uppercase Double and other times the lower case double. If someone could clarify what this means that'd be great!

推荐答案

Double 是一个包装类,

Double 类包装了对象中的原始类型 double.一个Double 类型的对象包含一个类型为 double 的单个字段.

The Double class wraps a value of the primitive type double in an object. An object of type Double contains a single field whose type is double.

此外,该类提供几种转换a的方法double 到 String 和 String 到 a双倍,以及其他常数和处理a时有用的方法双倍.

In addition, this class provides several methods for converting a double to a String and a String to a double, as well as other constants and methods useful when dealing with a double.

双数据类型,

双精度数据类型是双精度 64 位 IEEE 754浮点.它的取值范围是4.94065645841246544e-324d 至 1.79769313486231570e+308d(正或负).对于十进制值,此数据类型为一般是默认选择.作为上面提到,这种数据类型应该永远不要用于精确值,例如作为货币.

The double data type is a double-precision 64-bit IEEE 754 floating point. Its range of values is 4.94065645841246544e-324d to 1.79769313486231570e+308d (positive or negative). For decimal values, this data type is generally the default choice. As mentioned above, this data type should never be used for precise values, such as currency.

检查每个数据类型及其范围:Java 的原始数据类型.

Check each datatype with their ranges : Java's Primitive Data Types.

重要提示:如果您考虑使用双精度值,您需要在使用前重新考虑.Java 陷阱:双

Important Note : If you'r thinking to use double for precise values, you need to re-think before using it. Java Traps: double

相关文章