r/ProgrammerAnimemes • • Dec 20 '19

Java Breathing First Form: Implicit Conversion

Post image
982 Upvotes

14 comments sorted by

View all comments

Show parent comment

7

u/ThePyroEagle λ Dec 21 '19

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.