Java is static typing. The casts basic types are automatic (if I recall correctly, it's been a while since writing Java for me). So it should round it down if it had any fractionals.
int to float is an implicit cast, but float to int isn't. The OP's code still compiles because the compound assignment x /= 1.0f; is lowered into x = (int) (x / 1.0f); by the compiler.
View all comments
Show parent comment
12
u/manghoti Dec 20 '19
Java is static typing. The casts basic types are automatic (if I recall correctly, it's been a while since writing Java for me). So it should round it down if it had any fractionals.