Skip to content

Update java-operator.md #108

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 14, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions contents/java-operator.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
##Java += 操作符实质
## Java += 操作符实质

###问题
### 问题
我之前以为:
i += j 等同于 i = i + j;
但假设有:
Expand All @@ -11,7 +11,7 @@ long j = 8;
这时 i = i + j 不能编译,但 i += j 却可以编译。这说明两者还是有差别的
这是否意味着,i += j,实际是等同于 i= (type of i) (i + j)呢?

###回答
### 回答
这个问题,其实官方文档中已经解答了。 请看这里 [§15.26.2 Compound Assignment Operators](http://docs.oracle.com/javase/specs/jls/se8/html/jls-15.html#jls-15.26.2)


Expand Down