Java - whole loop vs do while loop

Description

whole loop vs do while loop

Demo

public class Whileloopexample {

  public static void main(String[] args) {
    // TODO Auto-generated method stub
    // while//from  w  w w .ja  va2  s  . co  m
    int x = 4;
    while (x < 20) {
      System.out.println(x);
      x++;
    }

    // do while
    int x2 = 4;
    do {
      System.out.println(x2);
      x2 = x2 + 1;
    } while (x2 < 20);
  }

}