Day7自增自减与Math类

package operator;

public class Demo4 {
    public static void main(String[] args) {
        // ++  --  自增   自减  一元运算符
        int a = 1;
        int b = a++;//先赋值,后自增
        //a = a+1;
        int c = ++a;//先自增,后赋值根据++这一符号所在的位置有所不同
        //a = a+1;

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

        //幂运算   在JAVA中借助工具类来操作
        double pow = Math.pow(2,3);
        System.out.println(pow);
    }
}
posted @ 2025-08-28 01:35  冰涿  阅读(7)  评论(0)    收藏  举报