create a loop in java not in javascript

Here are examples of different types of loops in Java:

For Loop:

for(int i = 0; i < 10; i++) {
    // code to be executed repeatedly
}
70 chars
4 lines

While Loop:

while(condition) {
    // code to be executed repeatedly
}
59 chars
4 lines

Do While Loop:

do {
    // code to be executed repeatedly
} while(condition);
63 chars
4 lines

Loops in Java are used to execute a block of code repeatedly until a specific condition is met. The for loop is used when the number of iterations is known beforehand, while the while and do-while loops are used when the number of iterations is not known beforehand.

gistlibby LogSnag