public class Test1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
int i1 = 10;
int i2 = 20;
int i = i2++; //先用再加
System.out.print("i=" + i);//20
System.out.println(" i2=" + i2);//21
i = ++i2;//先加再用
System.out.print("i=" + i);//22
System.out.println(" i2=" + i2);//22
i = --i1;//先减再用
System.out.print("i=" + i);//9
System.out.println(" i1=" + i1);//9
i = i1--;//先用再减
System.out.print("i=" + i);//9
System.out.println(" i1=" + i1);//8
}
}
关于自加,自减的小总结(初级)
最新推荐文章于 2022-02-25 22:31:36 发布