Java: Prefix/postfix of increment/decrement operators?

前端 未结 10 1429
不知归路
不知归路 2020-11-22 07:17

From the program below or here, why does the last call to System.out.println(i) print the value 7?

class PrePostDemo {
     public          


        
10条回答
  •  情话喂你
    2020-11-22 07:54

    It prints 7 for the last statement, cos in the statement above, it's value is 6 and it's incremented to 7 when the last statement gets printed

提交回复
热议问题