++i i++ java code example
Example 1: ++i vs i++ java
int i = 3;
int a = i++; // a = 3, i = 4
int b = ++a; // b = 4, a = 4
Example 2: ++i vs i++ java
int a = 0;
int b = a++; // b = 0; a = 1
a = 0;
b = ++a: // b = 1; a = 1
int i = 3;
int a = i++; // a = 3, i = 4
int b = ++a; // b = 4, a = 4
int a = 0;
int b = a++; // b = 0; a = 1
a = 0;
b = ++a: // b = 1; a = 1