Do While Loop in Java



This video tutorial explains the do while loop available in java programming.

You will learn what is a do while loop, what is the use of it, what is the syntax of it, how to use it in detail with examples.
You will learn how to generate a menu using do while loop in this tutorial.

Source code for this video tutorial


package learningJava;

import java.util.Scanner;

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

  Scanner input = new Scanner(System.in);
  
  do{
   System.out.println("1 C programming");
   System.out.println("2 C++ programming");
   System.out.println("3 Java programming");
   System.out.println("enter yes to see this menu again");
   
  }while( input.nextLine().contentEquals("yes") );
  
  input.close();

 }

}