+ 1
Why should I add cast to a float in Java?
I can simply write it like others https://code.sololearn.com/cJqVD01HQ5w1/?ref=app
2 Respuestas
+ 8
Declaring float will result in loss of precision.so,java needs you to do the cast to make a float variable by declaration.
By default, java compiler perceives as being a double 64 bits and not as a float 32 bits.
+ 1
Thanks you Chaithra Gowda👑