package review20140420;
/*
 * 自增和自减
 */
public class Test3 {
    //程序的入口
    public static void main(String[] args) {
        //定义变量
        int a1=10;
        int b1=10;
        //++或--后,先赋值,后自增或自减
        System.out.println(a1++);
        System.out.println(a1);
        System.out.println(b1--);
        System.out.println(b1);
        //定义变量
        int a2=10;
        int b2=10;
        //++或--前,先自增或自减,后赋值
        System.out.println(++a2);
        System.out.println(a2);
        System.out.println(--b2);
        System.out.println(b2);
    }
}

输出结果

10
11
10
9
11
11
9
9

posted on 2016-04-20 19:38  yegcf  阅读(118)  评论(0编辑  收藏  举报