About 241,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 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 …

  3. Java Multi-Dimensional Arrays - GeeksforGeeks

    Apr 23, 2025 · In Two dimensional array the the row is present by the i and the column is present by the j and we can get the element using arr [i] [j] using the nested loop. arr is the name of the …

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

  5. Java Multi-Dimensional Arrays - W3Schools

    Loop Through a Multi-Dimensional Array. You can also use a for loop inside another for loop to get the elements of a two-dimensional array (we still have to point to the two indexes):

  6. 2D Array in Java – Two-Dimensional and Nested Arrays

    Aug 10, 2022 · You can loop through all the items in a two dimensional array by using a nested loop. Here's an example:

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

  8. Learn Java: Two-Dimensional Arrays Cheatsheet - Codecademy

    In Java, enhanced for loops can be used to traverse 2D arrays. Because enhanced for loops have no index variable, they are better used in situations where you only care about the values of …

  9. 2D Array in Java: Configuring Two-Dimensional Arrays

    Oct 26, 2023 · You can iterate over a 2D array using nested for-each loops. The outer loop iterates over the rows and the inner loop iterates over the columns. Here’s an example:

  10. Java Matrix - 2D Arrays - CodeGym

    Apr 6, 2025 · Using “for-each” loop Here’s another way to print2D arrays in Java using “ foreach loop ”. This is a special type of loop provided by Java, where the int[]row will loop through each …

  11. Some results have been removed
Refresh