About 21,600,000 results
Open links in new tab
  1. java - Possible to repeat an if statement? - Stack Overflow

    Jan 18, 2015 · else { System.out.println("Make sure your spelling is correct."); valid = false; } } while (!valid); The loop will repeat every time the final else is hit as it will set valid = false;. You …

  2. java - How to repeat "if" statement when output is false - Stack Overflow

    Sep 25, 2015 · Idiomatic way of making an infinite loop in Java is while(true): System.out.print("Pick a number 1-10: "); int number = input.nextInt(); if (number == random) { …

  3. java - How to repeat an if or switch statement if something out

    Dec 25, 2016 · public static String getCommand(Scanner scan, Map<String, String> options) { while (true) { String input = scan.nextLine(); if (options.containsKey(input)) { …

  4. Decision Making in Java (if, if-else, switch, break, continue, jump)

    Apr 16, 2025 · The if-else statement in Java is a powerful decision-making tool used to control the program's flow based on conditions. It executes one block of code if a condition is true and …

  5. Java Loops - GeeksforGeeks

    Apr 7, 2025 · The if-else statement in Java is a powerful decision-making tool used to control the program's flow based on conditions. It executes one block of code if a condition is true and …

  6. Loops in Java: Repeat your code multiple times

    When you want to repeat an operation or a code sequence several times, you should use a loop. The loop is used to repeat a statement or block of statements as long as a particular condition …

  7. 05 Repetition - lawrence.edu

    In chapter 5 we are going to see a variety of constructs that allow us to build repetition into our programs. The basic repetition construct in Java is the while loop. Its basic structure is as …

  8. Java If ... Else - W3Schools

    Use the if statement to specify a block of Java code to be executed if a condition is true. Note that if is in lowercase letters. Uppercase letters (If or IF) will generate an error. In the example …

  9. While loop in Java: repeats the code multiple times - Learn Java

    Let’s see a few examples of how to use a while loop in Java. The following examples show how to use the while loop to perform one or more operations as long a the condition is true. …

  10. Flow control (if, else, switch, loops): Loops (repeat loops) : Course ...

    In Java, there are three main types of repetition loops: for, while and do-while. Let's explore each of them, understand how they work and learn how to apply them efficiently. The for loop is …

Refresh