📄 mathtest.java
字号:
// Exercise 6.3: MathTest.java
// Testing the Math class methods.
public class MathTest {
public static void main( String args[] )
{
System.out.println( "Math.abs( 23.7 ) = " + Math.abs( 23.7 ) );
System.out.println( "Math.abs( 0.0 ) = " + Math.abs( 0.0 ) );
System.out.println( "Math.abs( -23.7 ) = " + Math.abs( -23.7 ) );
System.out.println( "Math.ceil( 9.2 ) = " + Math.ceil( 9.2 ) );
System.out.println( "Math.ceil( -9.8 ) = " + Math.ceil( -9.8 ) );
System.out.println( "Math.cos( 0.0 ) = " + Math.cos( 0.0 ) );
System.out.println( "Math.exp( 1.0 ) = " + Math.exp( 1.0 ) );
System.out.println( "Math.exp( 2.0 ) = " + Math.exp( 2.0 ) );
System.out.println( "Math.floor( 9.2 ) = " + Math.floor( 9.2 ) );
System.out.println( "Math.floor( -9.8 ) = " + Math.floor( -9.8 ) );
System.out.println( "Math.log( Math.E ) = " +
Math.log( Math.E ) );
System.out.println( "Math.log( Math.E * Math.E ) = " +
Math.log( Math.E * Math.E ) );
System.out.println( "Math.max( 2.3, 12.7 ) = " +
Math.max( 2.3, 12.7 ) );
System.out.println( "Math.max( -2.3, -12.7 ) = " +
Math.max( -2.3, -12.7 ) );
System.out.println( "Math.min( 2.3, 12.7 ) = " +
Math.min( 2.3, 12.7 ) );
System.out.println( "Math.min( -2.3, -12.7 ) = " +
Math.min( -2.3, -12.7 ) );
System.out.println( "Math.pow( 2.0, 7.0 ) = " +
Math.pow( 2.0, 7.0 ) );
System.out.println( "Math.pow( 9.0, 0.5 ) = " +
Math.pow( 9.0, 0.5 ) );
System.out.println( "Math.sin( 0.0 ) = " + Math.sin( 0.0 ) );
System.out.println( "Math.sqrt( 900.0 ) = " + Math.sqrt( 900.0 ) );
System.out.println( "Math.sqrt( 9.0 ) = " + Math.sqrt( 9.0 ) );
System.out.println( "Math.tan( 0.0 ) = " + Math.tan( 0.0 ) );
} // end main
} // end class MathTest
/**************************************************************************
* (C) Copyright 1992-2003 by Deitel & Associates, Inc. and *
* Prentice Hall. All Rights Reserved. *
* *
* DISCLAIMER: The authors and publisher of this book have used their *
* best efforts in preparing the book. These efforts include the *
* development, research, and testing of the theories and programs *
* to determine their effectiveness. The authors and publisher make *
* no warranty of any kind, expressed or implied, with regard to these *
* programs or to the documentation contained in these books. The authors *
* and publisher shall not be liable in any event for incidental or *
* consequential damages in connection with, or arising out of, the *
* furnishing, performance, or use of these programs. *
*************************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -