Activities

If your head isn't going in circles from all this looping, review the topics of this hour with the following activities:

  • Modify the Repeat program so that it uses a for loop instead of a while loop, and compare the efficiency of each approach.

  • Write a short program using loops that finds the first 400 numbers that are multiples of 13.

To see Java programs that implement these activities, visit the book's website at http://www.java24hours.com.

Get SAMS Teach Yourself Programming with Java™ in 24 Hours, FOURTH 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.