About 20,400,000 results
Open links in new tab
  1. java - Complex updating rule in 'for' loop - Stack Overflow

    Dec 19, 2012 · I'm trying to write the following 'while' loop: int x = N-1, y = 0; while ( y < M ) { /* Some work */ if ( x > 0 ) x--; else y++; } as a 'for' loop. This was my failed attempt: for ( int x = …

  2. Java For Loop - W3Schools

    When you know exactly how many times you want to loop through a block of code, use the for loop instead of a while loop: Statement 1 is executed (one time) before the execution of the …

    Missing:

    • Update

    Must include:

  3. JAVA: Trying to update variables inside a for loop with …

    Oct 28, 2016 · for (int i = 1; i < players.length; i=i+1) { if (players[i].getHighScore() > max) { bestIndex = i; max = players[i].getHighScore(); bestName = players[i].getName(); …

  4. java - How to update a string on each iteration of for loop?

    Mar 24, 2017 · One way of doing it would be like this: up = up.substring(1); System.out.println(up); You can do this with char Array. char c = '\0'; String up="hello world"; char[] charArray = …

  5. Java Loops - GeeksforGeeks

    Apr 7, 2025 · Increment/ Decrement: It is used for updating the variable for next iteration. Loop termination:When the condition becomes false, the loop terminates marking the end of its life …

  6. What is the update part of a for loop in Java? - Sarthaks eConnect

    Apr 19, 2023 · The update part of a for loop is the third part of the loop statement in Java. It is used to update the loop counter after each iteration and is executed at the end of each iteration.

  7. When Should You Use a Command in the Update Statement of a Java For-Loop?

    Including commands in the update section of a for-loop can enhance readability and maintainability in specific scenarios. It allows you to execute an action each time the loop …

  8. Java For Loop - GeeksforGeeks

    Apr 17, 2025 · Java for loop is a control flow statement that allows code to be executed repeatedly based on a given condition. The for loop in Java provides an efficient way to iterate …

    Missing:

    • Update

    Must include:

  9. Understanding Java For Loops with Syntax and Examples

    Apr 22, 2025 · A Java for loop is a control flow statement that executes a block of code repeatedly based on a given condition and specified iterations. It consists of three parts: initialisation, …

  10. Understanding for loop in Java (Different Types and Examples)

    Dec 26, 2024 · Update is used for modifying the variable after each iteration is completed. System.out.println(i); In the above example, We have initialized the loop variable 'i' to'1'. Then, …

    Missing:

    • Update

    Must include:

  11. Some results have been removed
Refresh