Java Program showing use of Do_while loop…

Do_while loop

This is exit control loop.
Syntax:
do
{
Statements;
}while(condition);
Example:
class DoWhile
{
  public static void main(String args [])
  {
    int n=10;
    do
    {
      System.out.println(“Tick ” + n);
    }while(–n>0);
  }
}
Output:
D:java>java DoWhile
Tick 10
Tick 9
Tick 8
Tick 7
Tick 6
Tick 5
Tick 4
Tick 3
Tick 2
Tick 1

Add Comment