Answers to Self-Review Exercises

D.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) Random.

i) activation record, stack frame.

j) stack overflow.

k) scope.

l) method overloading.

m) method call.

D.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.

D.3 The following solution demonstrates the Math class methods in Fig. D.1:

 1   // Exercise D.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( ...

Get Android™ How to Program, Second 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.