📜  java ++i 和 i++ 循环的区别 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:40.193000             🧑  作者: Mango

代码示例1
//no difference in a loop.
for (int i = 0; i < 100; i++) {
}

for (int i = 0; i < 100; ++i) {
}
//however when doing:
int a = 0;
int b = a++; // b = 0; a = 1

a = 0;
b = ++a; // b = 1; a = 1