for loop in multidimensional array java

Solutions on MaxInterview for for loop in multidimensional array java by the best coders in the world

we are a community of more than 2 million smartest coders
registration for
employee referral programs
are now open
get referred to google, amazon, flipkart and more
register now
  
pinned-register now
showing results for - "for loop in multidimensional array java"
Amelia
16 Aug 2017
1public class ForLoopExample {
2    public static void main(String[] args) {
3        int[][] values = { { 1, 2, 3 }, { 4, 5, 6 }, { 7, 8, 9 } };
4         
5        System.out.println("Elements are :");
6        for(int i=0; i< values.length; i++) {
7            for(int j=0; j< values[i].length; j++) {
8                System.out.print(values[i][j] + "\t");
9            }
10            System.out.println("");
11        }
12    }
13}