AndroidApacheAutomation FrameworkAutomation/QTP/Selenium BlogsGoogle adsenseJava, JavaScriptWordpress

How to use while loop in java

While loop in Java

import java.util.Scanner;

class WhileLoop {
public static void main(String[] args) {
int i;

Scanner input = new Scanner(System.in);
System.out.println(“Please input an integer value”);

while ((i = input.nextInt()) != 0) {
System.out.println(“You haveĀ entered ” + i);
System.out.println(“Please input an integer value”);
}

System.out.println(“Gone out of loop”);
}
}