Java

While

While loop is a control flow statement that allows code to be executed repeatedly based on a given Boolean condition., The while loop can be thought of as a repeating if statement., It is used for iterating a part of the program several times., When the number of iteration is not fixed then while loop is used., While loop executes till the condition becomes false.the while loop is that the loop might not ever run. When the expression is tested and the result is false, the loop body will be skipped and the first statement after the while loop will be executed.,

 

Do While

In Java, the do-while loop is used to execute a part of the program again and again., do-while loop is an Exit control loop., If the number of iteration is not fixed then the do-while loop is used., This loop executes at least once because the loop is executed before the condition is checked., Therefore, unlike for or while loop, a do-while check for the condition after executing the statements or the loop body.,

 

For Loop

The for loop in java is used to iterate and evaluate a code multiple times., A for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times., When the number of iterations is known by the user, it is recommended to use the for loop., In java there are 3 types of for loops, they are as follows:, 1. Simple for loop, 2. For-each loop, 3. labelled for loop,