Exercises
3.10 Compare and contrast the
if
single-selection statement and thewhile
iteration statement. How are these two statements similar? How are they different?3.11 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?
3.12 Describe the two ways in which control statements can be combined.
3.13 What type of iteration 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.
3.14 What is the difference between preincrementing and postincrementing ...
Get Java How To Program, Late Objects, 11th 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.