There are three types of Java loop statements. Loops may be used in a situation when we need to execute a block of code several times. The loop statements are:
- for loop
- while loop
- do-while loop
A simple for loop is a repetition control structure that allows you to efficiently write a loop that needs to execute a specific number of times. A for loop is useful when you know how many times a task is to be repeated.
The while loop statements executes as long as the loop condition condition is true. This will continue as long as the expression result is true.
do while Loop
Java Tutorial on this website:
For more information on Java, visit the official website :