Source of StaticImportTest.java


  1: // Fig. 8.14: StaticImportTest.java
  2: // Using static import to import static methods of class Math.
  3: import static java.lang.Math.*;
  4: 
  5: public class StaticImportTest 
  6: {
  7:    public static void main( String args[] ) 
  8:    {
  9:       System.out.printf( "sqrt( 900.0 ) = %.1f\n", sqrt( 900.0 ) );
 10:       System.out.printf( "ceil( -9.8 ) = %.1f\n", ceil( -9.8 ) );
 11:       System.out.printf( "log( E ) = %.1f\n", log( E ) );
 12:       System.out.printf( "cos( 0.0 ) = %.1f\n", cos( 0.0 ) );
 13:    } // end main
 14: } // end class StaticImportTest
 15: 
 16: 
 17: /**************************************************************************
 18:  * (C) Copyright 1992-2005 by Deitel & Associates, Inc. and               *
 19:  * Pearson Education, Inc. All Rights Reserved.                           *
 20:  *                                                                        *
 21:  * DISCLAIMER: The authors and publisher of this book have used their     *
 22:  * best efforts in preparing the book. These efforts include the          *
 23:  * development, research, and testing of the theories and programs        *
 24:  * to determine their effectiveness. The authors and publisher make       *
 25:  * no warranty of any kind, expressed or implied, with regard to these    *
 26:  * programs or to the documentation contained in these books. The authors *
 27:  * and publisher shall not be liable in any event for incidental or       *
 28:  * consequential damages in connection with, or arising out of, the       *
 29:  * furnishing, performance, or use of these programs.                     *
 30:  *************************************************************************/