Clarification regarding Postfix Increment Operator ++ :java

后端 未结 5 524
情深已故
情深已故 2020-12-17 04:30
int i = 0;
boolean b = true;
System.out.println(b && !(i++ > 0))

When I compile the above code I

5条回答
  •  有刺的猬
    2020-12-17 05:00

    You want to use ++i if you want to increment i and return the incremented value. i++ returns the non incremented value.

提交回复
热议问题