其他分享
首页 > 其他分享> > 一些工具类

一些工具类

作者:互联网

代码1

/*
java 语言中线程共有六种状态,分别是:

NEW(初始化状态)
RUNNABLE(可运行 / 运行状态)
BLOCKED(阻塞状态)
WAITING(无时限等待)
TIMED_WAITING(有时限等待)
TERMINATED(终止状态)
*/
public class Demo1 {
    public static void main(String[] args) {
        System.out.println("Math.abs(-10) = " + Math.abs(-10));
        System.out.println("Math.ceil(3.14) = " + Math.ceil(3.14));
        System.out.println("Math.floor(9.8) = " + Math.floor(9.8));
        System.out.println("Math.random() = " + Math.random());
        System.out.println("Math.pow(2,4) = " + Math.pow(2, 4));
        System.out.println("Math.sqrt(9) = " + Math.sqrt(9));
        System.out.println("Math.round(3.14) = " + Math.round(3.14));
        System.out.println("Math.round(3.4) = " + Math.round(3.4));
        System.out.println("Math.round(3.5) = " + Math.round(3.5));
        System.out.println("Math.PI = " + Math.PI);
    }
}

输出结果

Math.abs(-10) = 10
Math.ceil(3.14) = 4.0
Math.floor(9.8) = 9.0
Math.random() = 0.8814462121707075
Math.pow(2,4) = 16.0
Math.sqrt(9) = 3.0
Math.round(3.14) = 3
Math.round(3.4) = 3
Math.round(3.5) = 4
Math.PI = 3.141592653589793

Process finished with exit code 0

代码2

 

标签:3.14,System,println,一些,工具,round,Math,out
来源: https://www.cnblogs.com/hbxZJ/p/15746983.html