N. Achyut java Do While Loop in Java | Basic Java Tutorial

Do While Loop in Java | Basic Java Tutorial

Do while loop in java

Do while loop in Java : While loop is the type of looping structure in which you can able to execute a block of code or statements multiple times.

The do-while loop executes the body of the loop at least once even if the condition is false at the first attempt.

Syntax for do while loop

  do
      {
        statements .. 
      }
      while(conditions);

Program to demonstrate Do While Loop in java

package practice_09;
public class doWhileLoop 
{

    public static void main(String[] args) 
    {
      int i = 1;
      do
      {
          System.out.println("Inside do-while loop");
          i++;
      }
      while(i>=5);
        
    }
    
}

Related Post