Java – interpret scientific symbols as int or float?

If I use scientific symbols (such as 1e9) to encode a number in my code, the type of the number will be (int, long, float, double...)?

When the significant digits or exponents are floating-point numbers, they obviously cannot be integers, but in the above case?

Solution

E make it a floating point text From JLS (§ 3.10.2. Floating point literals):

Therefore, the 1e9 type is double and 1e9d On the other hand, 1e9f is floating point

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>