O'Reilly logo

Java™ How to Program, Seventh Edition by P. J. Deitel - Deitel & Associates, Inc., H. M. Deitel - Deitel & Associates, Inc.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Answers to Self-Review Exercises

6.1
  1. method call.

  2. local variable.

  3. return.

  4. void.

  5. top.

  6. last-in, first-out (LIFO).

  7. return; or return expression; or encountering the closing right brace of a method.

  8. Random.

  9. activation record, stack frame.

  10. stack overflow.

  11. scope.

  12. method overloading.

  13. method call.

6.2
  1. class body.

  2. block that defines method rollDice’s body.

  3. class body.

  4. class body.

  5. block that defines method play’s body.

6.3The following solution demonstrates the Math class methods in Fig. 6.2:
 1 // Exercise 6.3: MathTest.java
 2 // Testing the Math class methods.
 3
 4 public class MathTest
 5 {
 6    public static void main( String args[] )
 7    {
 8       System.out.printf( "Math.abs( 23.7 ) = %f\n", Math.abs( 23.7 ) );
 9       System.out.printf( "Math.abs( 0.0 ) = %f\n", Math.abs( 0.0 ) ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required