public class TestOperator{ public static void main(String[] args) { int a = 3; int b = a++; //执行完后,b=3。先给b赋值,再自增。 int c = ++a; //执行完后,c=5。先自增,再给b赋值 System.out.println(a); System.out.println(b); System.out.println(c); } }
public class TestOperator{ public static void main(String[] args) { int a = 3; int b = a++; //执行完后,b=3。先给b赋值,再自增。 int c = ++a; //执行完后,c=5。先自增,再给b赋值 System.out.println(a); System.out.println(b); System.out.println(c); } }