O'Reilly logo
  • You Wang thinks this is interesting:

This program uses a while loop for the simple, repetitive task of printing the output shown below. After the third line, the lines to be printed differ only in the value of the index counting the line printed, so we define a variable i to contain that index. After initializing the value of i to 4, we enter into a while loop where we use the value of i in the System.out.println() statement and increment it each time through the loop. After printing 10th Hello, the value of


Cover of Computer Science: An Interdisciplinary Approach


It's easy to forget to modify the variable and create an infinite loop......