public class Demo04 {
public static void main(String[] args) {
//1、算数运算符 ++ --
int a = 3;
int b = a++; //a++ = a=a+1 //执行完这行代码后,先给b赋值,再自增;
System.out.println("a="+a);
System.out.println("b="+b);
int c = ++a; //++a = a=a+1 //执行完这行代码前,先自增,再给c赋值;
System.out.println("c="+c);
System.out.println("a="+a);
System.out.println("b="+b);
System.out.println("c="+c);
}
}
a=4
b=3
c=5
a=5
b=3
c=5
原文:https://www.cnblogs.com/singerw/p/14088057.html