自增运算符

自增运算符:

以 a++ 和 ++a 为例

public class Demo4 {
    public static void main(String[] args) {
        //++  -- 自增自减 一元运算符
        int a = 3;

        int b = a++;//先将a的值赋给 b,再给 a 自增
        System.out.println(a);//此时a的值变为 4

        int c = ++a;//先给 a 自增,再将值赋给 c
        System.out.println(a);//此时 a 的值变为 5

        System.out.println(b);
        System.out.println(c);

        //幂运算
        double  pow = Math.pow(2, 3);
        System.out.println(pow);
    }


}

原文地址:https://www.cnblogs.com/XiaoWubeginning/p/14093109.html