i in Java is a postfix increment operator that increments the value of i by 1. It first returns the current value of i, then increments it and assigns it back to i. The difference from the prefix increment operator i is that i first returns the current value and then increments it, while i first increments and then returns.
i in Java
i in Java
is a postfix increment operator , which increments the value of variable i
by 1.
Grammar:
<code class="java">i++</code>
Working principle:
i
will Variable i
is evaluated and its current value is returned. i
by 1. i
. Example:
<code class="java">int i = 5; System.out.println(i); // 输出 5 i++; System.out.println(i); // 输出 6</code>
The difference between the prefix increment operator i:
i
returns the current value of a variable before incrementing it, while prefix increment operator i
increments a variable before returning its value. Note:
i
only applies to basic types (such as int
and double
) and String type variables. i
is a unary operator, which means it can only act on one operand. The above is the detailed content of What does i+ mean in java. For more information, please follow other related articles on the PHP Chinese website!