0

Float in java

In Java, why do we add “f” at the end of the number E.g float a=2.34f;

25th Apr 2020, 12:08 PM
Zhengrong Yan
Zhengrong Yan - avatar
1 Resposta
+ 3
When you don't java, as default, will save it as double. If you don't want too much digits after dot, use float and explicitly tell compiler that it is float by adding 'f' at the end.
25th Apr 2020, 12:16 PM
Mustafa K.
Mustafa K. - avatar