自增运算及幂运算

自增运算:{

  int a = 10;

  int b = a++;

  System.out.println(b)

  System.out.println(a)

  上面为先把a赋值给b然后再自增,结果为b=10,a = 11;

  int c = ++a;

  System.out.println(c)

  System.out.println(a)

  上面为先执行自增再把a 赋值给c,结果为c =11,a = 11;

}

幂运算:{

  公式:Math.pow(基数,幂)

  栗子:Math.pow(2,3); 结果为2^3 = 8

}

posted @ 2020-05-03 22:09  多米诺的古牌  阅读(172)  评论(0)    收藏  举报