Exercises

2.7 Fill in the blanks in each of the following statements:

a) ________ are used to document a program and improve its readability.

b) A decision can be made in a Java program with a(n) ________.

c) Calculations are normally performed by ________ statements.

d) The arithmetic operators with the same precedence as multiplication are ________ and _______.

e) When parentheses in an arithmetic expression are nested, the ________ set of parentheses is evaluated first.

f) A location in the computer’s memory that may contain different values at various times throughout the execution of a program is called a(n) _______.

2.8 Write Java statements that accomplish each of the following tasks:

a) Display the message "Enter an integer: ", leaving ...

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.