自增自减运算符+Math类初识

 1 public class Demo8 {
 2     public static void main(String[] args) {
 3         //++ -- 自增,自减  一元运算符
 4         int a = 3;
 5         int b = a++;//执行完这行代码后,先给b赋值,再自增
 6         //a = a + 1;
 7         System.out.println(a);
 8         //a = a + 1;
 9         int c = ++a;//执行完这行代码后,先自增,再给b赋值
10 
11         System.out.println(a);
12         System.out.println(b);
13         System.out.println(c);
14 
15         //幂运算 2^3 2*2*2 = 8,  很多运算,我们会使用一些工具类来操作!
16         double pow = Math.pow(3,2);
17         System.out.println(pow);
18     }
19 }

 

posted @ 2021-03-12 23:07  HeartlessHero  阅读(54)  评论(0)    收藏  举报