As far as I know, i+=j; and i=i+j have the same meaning
int i = 5;
long j = 8;
If I = i+j;, it can't be compiled. If I = j;, it runs well I wonder why.
java casting variable-assignment assignment-operator operator
If you look at JLS ([link][jls]), you can see that a complex substitution operator, such as E1 + = E2, is a combination of: E1 = (Data type of E1) ((E1) op (E2)). So there's no problem with compiling. For example,
short x = 3;
x += 4.6;
Silver
short x = 3;
x = (short)(x + 4.6);
It changes in the same way.
885 When building Fast API+Uvicorn environment with PyInstaller, console=False results in an error
606 Uncaught (inpromise) Error on Electron: An object could not be cloned
577 PHP ssh2_scp_send fails to send files as intended
567 rails db:create error: Could not find mysql2-0.5.4 in any of the sources
© 2024 OneMinuteCode. All rights reserved.