The while statement in Java

  1. Syntax of the while statement in Java:

          while ( boolean expression )       
    while ( boolean expression ) { more-than-one-statement }

    Execute statement(s) as long as boolean expression is true

  2. Important note:

    The statements in the while body MUST affect the boolean condition (or else, the while loop will never end - infinite loop....)