Varying behavior for possible loss of precision
That’s because b += 1.0; is equivalent to b = (int) ((b) + (1.0));. The narrowing primitive conversion (JLS 5.1.3) is hidden in the compound assignment operation. JLS 15.26.2 Compound Assignment Operators (JLS Third Edition): A compound assignment expression of the form E1 op= E2 is equivalent to E1 = (T)((E1) op (E2)), where T … Read more