About 847,000 results
Open links in new tab
  1. Java data validation with while loops - Stack Overflow

    (y/n): ", "y", "n"); System.out.print(getContinue); System.out.println(); } } public static double getDoubleWithinRange(Scanner sc, String prompt, double min, double max) { double d = 0.0; …

  2. while Keyword in Java: Usage & Examples - DataCamp

    The while keyword in Java is used to create a loop that executes a block of code as long as a specified condition is true. It is a control flow statement that allows repeated execution of a …

  3. The while and do-while Statements (The Java™ Tutorials - Oracle

    The Java programming language also provides a do-while statement, which can be expressed as follows: do { statement(s) } while (expression); The difference between do-while and while is …

  4. Java While Loop - W3Schools

    Loops are handy because they save time, reduce errors, and they make code more readable. The while loop loops through a block of code as long as a specified condition is true: In the …

  5. Java while Loop - GeeksforGeeks

    Nov 11, 2024 · Java while loop is a control flow statement used to execute the block of statements repeatedly until the given condition evaluates to false. Once the condition becomes …

  6. Java - Input Validation with while loop

    public static void main(String args[]) { Scanner keyboard = new Scanner (System.in); System.out.print("Enter a number in the " + "range of 1 through 100: "); int number = …

  7. java - Using while loop as input validation - Stack Overflow

    I'm trying to use while loop to ask the user to reenter if the input is not an integer. for eg. input being any float or string.

  8. Effective Scanner Input Validation in Java Using While Loops

    Input validation is crucial in Java programming, especially when accepting user input through the Scanner class. Using a while loop for input validation allows you to repeatedly prompt the user …

  9. Java While Loop: Syntax, Examples and Common Pitfalls

    Dec 19, 2024 · The while loop in Java is a control flow statement used to repeatedly execute a block of code as long as a specified condition is true. It is one of the most fundamental looping …

  10. Java While Loop - Baeldung

    Feb 16, 2025 · The while loop is Java’s most fundamental loop statement. It repeats a statement or a block of statements while its controlling Boolean-expression is true. The syntax of the …

  11. Some results have been removed
Refresh