java loop while code example
Example 1: java do while
do {
// loop content
} while (/* condition */);
Example 2: loop while in java
while(i < 5) //while i < 5 stay in the loop
{
System.out.print(i);
i++;
}
/*
do someting
change variable
call methods
etc...
*/
Example 3: do while loop java
package com.journaldev.javadowhileloop;
public class JavaDoWhileLoop {
public static void main(String[] args) {
int i = 5;
do {
System.out.println(i);
i++;