10.java中数学和时间函数

阅读 69

2022-01-17

Math类
    Math.cbrt()//立方根
    Math.sqrt()//平方根
    Math.pow(x,y)//x的y次方
    Math.abs()//绝对值
    Math.max(x,y)//最大值
    Math.random()//0.0~1.0之间的随机值
    Math.round()//四舍五入后的值
    Math.sin()//正弦值


Date类
    new Date()//获得当前时间
    new Date().getHours()//获得当前小时
    new Date().getMinutes()//获得当前分钟
    new Date().getTime()//获得当前时间进度(毫秒为单位)

精彩评论(0)

0 0 举报