The do statement in Java

  1. Syntax of the for statement in Java:

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

  2. A do loop can ALWAYS be replaced by a while loop:

    
          do
             statement
          while ( boolean expression )       
    
    statement while ( boolean expression ) { statement }

    NOTE: We have to duplicate the statement(s)

  3. Do loops are rarely used....