/*
*测试自增、自减操作
*/
public class SelfAction
{
public static void main(String[] args)
{
int x = 10;
int a = x + x++;
System.out.println("a=" + a);
System.out.println("x=" + x);
int b = x + ++x;
System.out.println("b=" + b);
System.out.println("x=" + x);
int c = x + x--;
System.out.println("c=" + c);
System.out.println("x=" + x);
int d = x + --x;
System.out.println("d=" + d);
System.out.println("x=" + x);
}
}
输出 是
a=20
x=11
b=23
x=12
c=24
x=11
d=21
x=10