Posts

Showing posts with the label do-while loop

Difference between while and do-while statements in Java

1.   while loop is an entry controlled loop and do-while loop is an exit controlled loop. 2.  while loop first check the condition and then execute statements body .      do-while loop first execute statements body and then check the condition. 3.  do-while loop execute the statement body at least once but while loop not. 4.  Syntax of while loop :                                          while(condition){                                              // statements           ...