美文网首页
运算法则3//自增自减

运算法则3//自增自减

作者: 哈迪斯Java | 来源:发表于2021-09-06 16:26 被阅读0次

    package operator;

    public class Demon4 {
    public static void main(String[] args) {
    //自增,自减
    int a = 3;
    int b = a++;//a++ a=a+1;执行完这行代码之后,先给b赋值,再自增
    int c = ++a;//执行完这行代码之前,先自增,再给c赋值。
    System.out.println(a);
    System.out.println(b);
    System.out.println(c);
    //幂运算
    //java中没有该运算,可借助数学工具
    double pow = Math.pow(2,3);
    System.out.println(pow);
    //很多运算,我们可以借助一些工具类进行操作
    }
    }

    相关文章

      网友评论

          本文标题:运算法则3//自增自减

          本文链接:https://www.haomeiwen.com/subject/tnzewltx.html