public class Test01 {
// 这是main方法,是实现程序主要逻辑
public static void main(String[] args) {
// 常用属性
System.out.println(Math.PI);
// 常用方法
// 随机数,[0.0, 1.0)
System.out.println("随机数"+Math.random());
// 绝对值
System.out.println("绝对值"+Math.abs(-80));
// 向上取值
System.out.println("向上取值"+Math.ceil(9.1));
// 向下取值
System.out.println("向下取值"+Math.floor(9.9));
// 四舍五入
System.out.println("四舍五入"+Math.round(3.6));
// 最值
System.out.println("最大值"+Math.max(3, 6));
System.out.println("最小值"+Math.min(3, 6));
}
}
原文:https://www.cnblogs.com/shanlei/p/14167314.html