Practise 2 - question about loop

class Woo {
public static void main(String[ ] args) {
int w = 1;
do while ( w < 1 )
System.out.print( "w is " + w );
while ( w > 1 ) ;
} }

can you explain to me? I searched and have just found the structure about " do { } while(expression); " and here, there's no part "while (expression);" of the do sentence.
Thanks in advance.

If you have look carefully at this code, you would notice that there is a nested while loop at line 4 inside a do-while loop. The while portion of this do-while loop is at line 6 as distinguished by the semicolon at the end of the while expression. Remember : the while portion of a do-while loop must always end with a semicolon as opposed to the closing curly bracket. Since the nested while at line 4 evaluates to false, line 5 will not be executed, so nothing is printed. The while portion of the do-while loop at line 6 will also evaluate to false, however, since this is a do-while loop, the do portion gets to execute at least once. In short, the do-while is executed once and nested while do nothing but no output is produced. The code would have been more readable if it is written with appropriate brackets as follows :
04.          do {
05.              while ( w < 1 )
06.                   System.out.print( "w is " + w );
07.          } while ( w > 1 ) ;
08.      }
09.  }

HTH

Thank you so much. It's so tricky.