This code seems to work in Java, breaking everything that I thought about knowing the language:
int x = 0;
x += 7.4;
x now has the value 7. Of course, you can't just write int x = 7.4 , so this behavior seems strange and inconsistent to me.
Why did the Java developers choose this behavior?
The question that mine was marked as a duplicate actually answered the question "what is happening", but not my main question: what is the rationale.
Brrch source
share