About 770,000 results
Open links in new tab
  1. java - Iterate through 2 dimensional array - Stack Overflow

    Sep 12, 2014 · In the first block, the inner loop iterates over each item in the row before moving to the next column. In the second block (the one you want), the inner loop iterates over all the …

  2. How to iterate a Multidimensional Array? - GeeksforGeeks

    Nov 7, 2022 · Multidimensional arrays are arrays that have more than one dimension. For example, a simple array is a 1-D array, a matrix is a 2-D array, and a cube or cuboid is a 3-D …

    Missing:

    • Loop Structure

    Must include:

  3. How to use for loop with two dimensional array in Java

    Dec 29, 2019 · To loop over two dimensional array in Java you can use two for loops. Each loop uses an index. Index of outer for loop refers to the rows, and inner loop refers to the columns. …

  4. Java Multi-Dimensional Arrays - GeeksforGeeks

    Apr 23, 2025 · Two-dimensional array is the simplest form of a multidimensional array. A 2-D array can be seen as an array storing multiple 1-D array for easier understanding. Syntax …

  5. How to loop over two dimensional array in Java? Example - Blogger

    Aug 8, 2021 · How to loop over two dimensional array in Java? Example. You can loop over a two-dimensional array in Java by using two for loops, also known as nested loop. Similarly to …

  6. java - For Loop 2D Array - Stack Overflow

    Aug 11, 2016 · You can replace the second loop with a while loop to ensure that exactly 3 cells are replaced : int i = 0; while(i < 3) { int x = rn.nextInt(3); int y = rn.nextInt(3); if (grid[x][y] != 'O') …

  7. java - For each loop using 2D array - Stack Overflow

    Nov 14, 2012 · To iterate through all the elements, you should consider a rows-elements structure. It's necessary that you get each row from the container, and then each element from …

  8. Multidimensional Arrays in C – 2D and 3D Arrays - GeeksforGeeks

    May 7, 2025 · To traverse the entire 3D array, you need to use three nested loops: an outer loop that goes through the depth (or the set of 2D arrays), a middle loop goes through the rows of …

  9. Nested Loops for 2D Arrays — CS Java

    In this lesson, you will learn how to use nested loops to traverse a 2D Array. Arrays know their length (how many elements they can store). The length is a public read-only field so you can …

  10. Iterating Through 2D Array Java - Coding Rooms

    Oct 5, 2020 · We explored using for loops with one-dimensional arrays. Now let’s jump into nested for loops as a method for iterating through 2D arrays. A nested for loop is one for loop …

  11. Some results have been removed
Refresh