In Java we categorize loops in two types –
1. Entry Controlled loop
2. Exit Controlled loop
Entry controlled loop
An entry-controlled loop checks the condition at the time of entry. Only if the condition is true, the program control enters the body of the loop. for and while loops are entry-controlled loops. For example – For loop and while loop.
Exit controlled loop
An exit-controlled loop checks the condition after executing its body. If the condition is true, loop will perform the next iteration otherwise program control will move out of the loop. do-while loop is an exit-controlled loop. For example – do-while loop. After this difference we will start the discussion on various types of loops we use in Java programming language.