do
The do keyword is used in conjunction with while to create a do-while loop, which executes a block of statements associated with the loop and then tests a boolean expression associated with the while. If the expression evaluates to true, the block is executed again; this continues until the expression evaluates to false.
1: public void testDoWhileLoop (){
2: boolean isTrue = false;
3: int x = 0;
4: do {
5: x++;
6: }while(isTrue);
7:
8: System.out.println(x);
9: //output is: 1 -- loop body has been executed once.
10: }
The text content of this page derived from wikipedia.org List of JavaKeywords page and available under the Creative Commons Attribution-ShareAlike License. The original work has been modified.