Answers to Self-Review Exercises

  1. B.1

    1. public.

    2. class.

    3. new.

    4. type, name.

    5. default package.

    6. instance variable.

    7. float, double.

    8. double-precision.

    9. nextDouble.

    10. modifier.

    11. void.

    12. nextLine.

    13. java.lang.

    14. import declaration.

    15. floating-point number.

    16. single-precision.

    17. %f.

    18. primitive, reference.

  2. B.2

    1. False. By convention, method names begin with a lowercase first letter and all subsequent words in the name begin with a capital first letter.

    2. True.

    3. True.

    4. True.

    5. False. A primitive-type variable cannot be used to invoke a method—a reference to an object is required to invoke the object’s methods.

    6. False. Such variables are called local variables and can be used only in the method in which they’re declared.

    7. True.

    8. False. Primitive-type instance variables are initialized ...

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.