Answers to Self-Review Exercises

6.1

a) method call.

b) local variable.

c) return.

d) void.

e) top.

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

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

h) SecureRandom.

i) stack frame, activation record.

j) stack overflow.

k) scope.

l) method overloading.

6.2

a) class body.

b) block that defines method rollDice’s body.

c) class body.

d) class body.

e) block that defines method main’s body.

6.3 The following solution demonstrates the Math class methods in Fig. 6.2:

 1   // Exercise 6.3: MathTest.java 2   // Testing the Math class methods. 3   public class MathTest 4   { 5      public static void main(String[] args) 6      { 7         System.out.printf( ...

Get Java™ How To Program (Early Objects), Tenth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.