直到今天,我还以为:
i += j;
Run Code Online (Sandbox Code Playgroud)
只是一个捷径:
i = i + j;
Run Code Online (Sandbox Code Playgroud)
但是如果我们试试这个:
int i = 5;
long j = 8;
Run Code Online (Sandbox Code Playgroud)
然后i = i + j;将不会编译但i += j;将编译正常.
这是否意味着事实上i += j;是这样的捷径
i = (type of i) (i + j)?
java casting operators variable-assignment assignment-operator
我尝试使用Google搜索和Stack Overflow搜索,但它没有显示任何结果.我在开源库代码中看到了这个:
Notification notification = new Notification(icon, tickerText, when);
notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_VIBRATE;
Run Code Online (Sandbox Code Playgroud)
"| ="(pipe equal operator)是什么意思?