Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

for loop in multidimensional array java

public class ForLoopExample {
    public static void main(String[] args) {
        int[][] values = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
         
        System.out.println("Elements are :");
        for(int i=0; i< values.length; i++) {
            for(int j=0; j< values[i].length; j++) {
                System.out.print(values[i][j] + "	");
            }
            System.out.println("");
        }
    }
}
 
PREVIOUS NEXT
Tagged: #loop #multidimensional #array #java
ADD COMMENT
Topic
Name
8+6 =