Google News
logo
Java - Interview Questions
Out of do…while and while – which loop is efficient?
In a do…while loop the statements are executed without testing the condition, the first time. From the second time the condition is observed. This means that the programmer does not have control right from the beginning of its execution. In a while loop, the condition is tested first and then only the statements are executed. 

This means it provides better control right from the beginning. Hence, while loop is more efficient than do…while loop.

Advertisement