Static import of Math class methods. - Java Language Basics

Java examples for Language Basics:import

Description

Static import of Math class methods.

Demo Code

import static java.lang.Math.*;

public class Main 
{
   public static void main(String[] args) 
   {//from   w ww .j  a va 2  s  .c  o  m
      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);
   } 
}

Result


Related Tutorials