Exercises (Sections C.1–C.13)
C.12 Explain what happens when a Java program attempts to divide one integer by another. What happens to the fractional part of the calculation? How can you avoid that outcome?
C.13 Describe the two ways in which control statements can be combined.
C.14 What type of repetition would be appropriate for calculating the sum of the first 100 positive integers? What type would be appropriate for calculating the sum of an arbitrary number of positive integers? Briefly describe how each of these tasks could be performed.
C.15 What is the difference between preincrementing and postincrementing a variable?
C.16 Identify and correct the errors in each of the following pieces of code. [Note: There may be more than one error ...
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.