A: alone
On the front and back of the operand, the result is the same (this is our common usage), the results were a normal operation plus minus one
class Add{
public static void main(String[] args){
int a = 3;
int b = 5;
/*
int c = a++;
System.out.println(c);//预计为3
System.out.println(a);//预计为4
int d = ++a;
System.out.println(d);//预计为4
System.out.println(a);//预计为4
*/
a++;
b--;
System.out.println(a);//预计为4
System.out.println(b);//预计为4
}
}
II: involved in computing
On a back:
a first value is assigned to others, a simple calculations themselves do
class Add{
public static void main(String[] args){
int a = 3;
int b = 5;
int c = a++;
System.out.println(c);//预计为3
System.out.println(a);//预计为4
/*int d = ++a;
System.out.println(d);//预计为4
System.out.println(a);//预计为4
*/
}
}
On a front:
a do first simple calculations, and then assigns the result to others
class Add{
public static void main(String[] args){
int a = 3;
int b = 5;
/*
int c = a++;
System.out.println(c);//预计为3
System.out.println(a);//预计为4
*/
int d = ++a;
System.out.println(d);//预计为4
System.out.println(a);//预计为4
}
}