About 8,260,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 …

  3. Traverse 2d Array Java - Know Program

    Traversing 2d Array Java by Taking User Input. Now let us see how to traverse a 2d array in Java after taking input from the end-user.

  4. 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 …

  5. Java Matrix - 2D Arrays - CodeGym

    Apr 6, 2025 · How to Print a 2D Array in Java? After you’re familiar with 2D Array traversal, let’s look at a few ways of printing 2D Arrays in Java. Using Nested “for” loop This is the most basic …

  6. How to Iterate Through a 2D Array in Java - HatchJS.com

    In this tutorial, we will discuss four different ways to iterate through a 2D array in Java: Using a for loop; Using an enhanced for loop; Using the `iterator()` method; Using the `forEach()` method; …

  7. Different Ways to Traverse an Array in Java - Online Tutorials …

    Using the for each loop − Since JDK 1.5, Java introduced a new for loop known as foreach loop or enhanced for loop, which enables you to traverse the complete array sequentially without …

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

    Aug 8, 2021 · Here is a Java program to iterate over a two-dimensional array in Java using traditional for loop. Though it's not necessary to use for loop, you can even use while loop or …

  9. 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 …

  10. java - Traversing 2d array row first and then column first - Stack Overflow

    I am looking for a way to traverse a 2d n by m int array (int[col][row]) first row by row (simple part) and then column by column, in Java. Here is the code for doing row by row, is there a way to...

Refresh