Java加等于或等于加运算符?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/31366081/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 10:58:23  来源:igfitidea点击:

Java plus equals or equals plus operator?

java

提问by 117

Is +=the same as =+?

+=一样的=+吗?

I can't find any reason for why the plus sign is reversible. For what reasons would I need to use one of the other? Where can i find docs on this i tried searching but didnt see the use of both.

我找不到加号可逆的任何原因。出于什么原因,我需要使用另一种?我在哪里可以找到这方面的文档我尝试搜索但没有看到两者的使用。

采纳答案by Eran

It's not the same.

这是不一样的。

x+=5is equivalent to x=x+5.

x+=5相当于x=x+5

x=+5(or x=(+5)) is equivalent to x=5.

x=+5(或x=(+5)) 等价于x=5