Answers to Self-Review Exercises

4.1
  1. sequence, selection, repetition.

  2. if...else.

  3. counter-controlled (or definite).

  4. sentinel, signal, flag or dummy.

  5. sequence.

  6. 0 (zero).

  7. strongly typed.

  8. prefixed.

4.2
  1. True.

  2. False. A set of statements contained within a pair of braces ({ and }) is called a block.

  3. False. A repetition statement specifies that an action is to be repeated while some condition remains true.

  4. True.

  5. True.

  6. False. The primitive types (boolean, char, byte, short, int, long, float and double) are portable across all computer platforms that support Java.

  7. True.

  8. False. The unary cast operator (double) creates a temporary floating-point copy of its operand.

  9. False. Instance variables of type boolean are given the value false by default.

  10. True.

4.3
x = x + 1; x += ...

Get Java™ How to Program, Seventh 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.