CHAPTER 41 — The Fantastic For Statement

Classic programmed-learning exercises, refreshed for modern Java and presented in the current MrStyner.com portfolio style.

Modern Java noteThis archive has been refreshed for Java 25 LTS. Core language concepts remain useful, while outdated setup instructions and browser-era Java are labeled or replaced. Java 26 is the current feature release; Java 25 is used here as the stable teaching baseline.
go to home page   hear noise   go to next page

created: 04/17/98; revised: 01/03/99, 10/28/99, 01/22/00, 07/20/02, 05/25/03, 01/19/06, 08/30/07

CHAPTER 41 — The Fantastic For Statement

The for statement is a convenient way to program counting loops, although it can be used to build all three types of loops. Anything it does could also be done with the fundamental control statements you already know. But the for statement often says just what you want in a compact, easily understood format.

Chapter Topics:

  • The three parts of all loops (review)
  • Syntax of the for statement
  • Using the for statement in counting loops
  • Equivalence of for and while loops

QUESTION 1:

What are the three types of loops?