While going through a class I saw 1.f
assigned as a value to a float variable. What is the use of the .
here? How is this different from just 1f
?
It's exactly the same as 1f
and means the number 1.0
expressed as a float
literal. Other ways to express the same literal include 1.0f
, +1.00000f
, 1e0f
, 1.e+0f
and so on.
For a detailed specification, see §3.10.2. Floating-Point Literals in the JLS.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With