请编程进行以下运算:
public class Demo {
public static void main(String[] args) {
System.out.println("嗨客网(www.haicoder.net)\n");
double a = Math.pow(3,5);
double b = Math.ceil(3.2);
double c = Math.floor(3.8);
double d = Math.round(5.6);
System.out.println("3 的 5 次幂:" + a);
System.out.println("3.2 向上取整:" + b);
System.out.println("3.8 向下取整:" + c);
System.out.println("5.6 四舍五入取整:" + d);
}
}
运行结果如下图:
以上案例通过 Math 类进行数学运算。