Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis+ 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 Respostas
+ 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š