public class Operator {
public static void main(String[] args) {
//++ -- 自增、自减 一元运算符
int a = 3;
int b = a++; //执行完这行代码后,先给b赋值,再自增
System.out.println(a);
int c = ++a; //执行完这行代码前,先自增,再给c赋值
System.out.println(a);
System.out.println(b);
System.out.println(c);
//幂运算 2^3 2*2*2 = 8
double pow = Math.pow(2,3);
System.out.println(pow);
}
}
输出结果:
4
5
3
5
8.0