Friday, 30 December 2016

Do While Loop In Java Example

package com.kt4study.corejava.loop;

/**
 @author kt4study.blogspot.co.uk
 
 */

public class DoWhileLoopExample {

  public static void doWhileLoopExampleDemo() {

    int i = 1;
    do{
      System.out.println("Value Of 'i' :: " + i);
      i++;
    }while(i <4)// Post condition check
    
  }

  public static void main(String[] args) {
    DoWhileLoopExample.doWhileLoopExampleDemo();
  }
}

Output →

Current value Of 'i' is :: 1
Current value Of 'i' is :: 2
Current value Of 'i' is :: 3

No comments:

Post a Comment