赞
踩
package operator; public class Demo05 { public static void main(String[] args) { int a = 3;//a 的初始值 int b = a++;//执行完这行代码后,先给b复制,再自增1 //这里隐藏了 a = a + 1 System.out.println(a); //这里隐藏了 a = a + 1 int c = ++a;//执行这行代码前,先自增1,再给c赋值 System.out.println(a); System.out.println(a); System.out.println(b); System.out.println(b); System.out.println(c); System.out.println(c); } }
4
5
5
3
3
5
5
package operator;
public class Demo06 {
public static void main(String[] args) {
//幂运算
double pow = Math.pow(2,3);//2的三次方
System.out.println(pow);
}
}
8.0
很多运算我们用一些工具类来操作
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。