集册 Java实例教程 静态导入Math类方法。

静态导入Math类方法。

欢马劈雪     最近更新时间:2020-01-02 10:19:05

487
提示:您可在线编辑运行本教程的实例 - 运行实例,去试试!
静态导入Math类方法。

import static java.lang.Math.*;
//from n o w j a v a . c o m - 时代Java

public class Main 

{

   public static void main(String[] args) 

   {

      System.out.printf("sqrt(900.0) = %.1f%n", sqrt(900.0));

      System.out.printf("ceil(-9.8) = %.1f%n", ceil(-9.8));

      System.out.printf("E = %f%n", E);

      System.out.printf("PI = %f%n", PI);

   } 

}