Answers to Self-Review Exercises

  1. E.1

    1. arrays.

    2. variables, type.

    3. enhanced for statement.

    4. index (or subscript or position number).

    5. two-dimensional.

    6. for ( double d : numbers ).

    7. an array of Strings, called args by convention.

  2. E.2

    1. False. An array can store only values of the same type.

    2. False. An array index must be an integer or an integer expression.

    3. For individual primitive-type elements of an array: False. A called method receives and manipulates a copy of the value of such an element, so modifications do not affect the original value. If the reference of an array is passed to a method, however, modifications to the array elements made in the called method are indeed reflected in the original. For individual elements of a reference type: True. ...

Get Android How to Program, 3/e 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.