summaryrefslogtreecommitdiffhomepage
path: root/zh-cn/java-cn.html.markdown
diff options
context:
space:
mode:
authorC. Bess <cbess@company.com>2015-11-09 17:55:53 -0600
committerC. Bess <cbess@company.com>2015-11-09 17:55:53 -0600
commitdf0992d72c2a28f140e6ff9681c505f36e19249a (patch)
tree508aa3abe4c25b957dca442560d9c95c9b1fc97a /zh-cn/java-cn.html.markdown
parentafc5ea14654e0e9cd11c7ef1b672639d12418bad (diff)
parentc460e1fafa0e9b4edc6a5cb35b970bb5cc030a81 (diff)
Merge remote-tracking branch 'adambard/master'
Conflicts: swift.html.markdown
Diffstat (limited to 'zh-cn/java-cn.html.markdown')
-rw-r--r--zh-cn/java-cn.html.markdown19
1 files changed, 11 insertions, 8 deletions
diff --git a/zh-cn/java-cn.html.markdown b/zh-cn/java-cn.html.markdown
index f7d319e6..a8fd2a4c 100644
--- a/zh-cn/java-cn.html.markdown
+++ b/zh-cn/java-cn.html.markdown
@@ -124,7 +124,7 @@ public class LearnJava {
// HashMaps
///////////////////////////////////////
- // 操作符
+ // 操作符
///////////////////////////////////////
System.out.println("\n->Operators");
@@ -149,7 +149,7 @@ public class LearnJava {
// 位运算操作符
/*
- ~ 补
+ ~ 取反,求反码
<< 带符号左移
>> 带符号右移
>>> 无符号右移
@@ -161,10 +161,13 @@ public class LearnJava {
// 自增
int i = 0;
System.out.println("\n->Inc/Dec-rementation");
- System.out.println(i++); //i = 1 后自增
- System.out.println(++i); //i = 2 前自增
- System.out.println(i--); //i = 1 后自减
- System.out.println(--i); //i = 0 前自减
+ // ++ 和 -- 操作符使变量加或减1。放在变量前面或者后面的区别是整个表达
+ // 式的返回值。操作符在前面时,先加减,后取值。操作符在后面时,先取值
+ // 后加减。
+ System.out.println(i++); // 后自增 i = 1, 输出0
+ System.out.println(++i); // 前自增 i = 2, 输出2
+ System.out.println(i--); // 后自减 i = 1, 输出2
+ System.out.println(--i); // 前自减 i = 0, 输出0
///////////////////////////////////////
// 控制结构
@@ -192,7 +195,7 @@ public class LearnJava {
}
System.out.println("fooWhile Value: " + fooWhile);
- // Do While循环
+ // Do While循环
int fooDoWhile = 0;
do
{
@@ -402,4 +405,4 @@ class PennyFarthing extends Bicycle {
* [泛型](http://docs.oracle.com/javase/tutorial/java/generics/index.html)
-* [Java代码规范](http://www.oracle.com/technetwork/java/codeconv-138413.html)
+* [Java代码规范](http://www.oracle.com/technetwork/java/codeconvtoc-136057.html)