可能重复:
explain working of post and pre increment operator in Java
What is the difference between int++ and ++int?Java中的++ int是什么?
在Java中,什么是++int
?它有什么作用?这是什么意思?
(对不起,我没有正确地提出这样的问题最后一次。)
可能重复:
explain working of post and pre increment operator in Java
What is the difference between int++ and ++int?Java中的++ int是什么?
在Java中,什么是++int
?它有什么作用?这是什么意思?
(对不起,我没有正确地提出这样的问题最后一次。)
++int
增量诠释1之前和int++
递增一后
a = 5; b = ++a; // a = 6, b = 6
a = 5; b = a++; // a = 6, b = 5
其他解决方法:'a'在分配后递增。 'b'使用'a'的旧值 – Sionide21 2012-04-09 12:09:44
int a=1;
System.out.println(a++);
打印 “1”
int a=1;
System.out.println(++a);
打印“2”
或者我可能不明白你的问题。
这与您在其他问题中得到的C++答案完全相同。 – 2012-03-29 00:55:07
将来,请在发布问题之前进行搜索。 – paxdiablo 2012-03-29 00:58:17
@Brendan,大部分都是真实的,但任何区别都完全[在此详述](http://stackoverflow.com/a/6457294/189950)。 – 2012-03-29 00:58:52