Zebra0.com

javaJava

Java

Learn Java in step-by-step lessons.

While Loops

While Loops

A while loop has just a test. If the condition in the test is true the entire body of the loop executes, even if the condition becomes false inside the loop. When body of the loop ends, the test is made again. A while loop executes 0 or more times.

Please study the material at each of the links below.

  1. Compare for and while

  2. A loop to count

  3. Blast off 2 ways

  4. Doubling a value

  5. An endless loop

  6. Ending a total loop with a sentinel value

  7. Ending a total loop by asking if there are more

  8. Display "pass" or "fail" for each grade

  9. Finding the smallest and largest

GlossaryGlossary for loopswhile lesson
Full Glossary