Math类和Random类
public class TestMath {
public static void main(String[] args) {
System.out.println(Math.max(10,2));//获得最大值
System.out.println(Math.min(10, 5));//获得最小值
System.out.println(Math.abs(-20));//获得绝对值
System.out.println(Math.random());//生成0-1的随机数
}
}

posted on 2023-11-13 20:48  杨申龙  阅读(16)  评论(0)    收藏  举报