Do While Loop in Java

Do While:
Do while loop executes statment until certain condition become false.

Syntax:
do
{
//body of the statement
}while<condition>


Note:
Please not that the condition is evaluated after executing the loop body.
So loop will be executed at least once even if the condition is false.


public class DoWhile {
 
  public static void main(String[] args) {

    int i =0;  
   
    do
    {
      System.out.println("i is : " + i);
      i++;
     
    }while(i < 5);
   
  }
}


Output:
i is : 0
i is : 1
i is : 2
i is : 3