Answers for "two dimensional array in java example program"

10

java two dimensional arrays

int[][] multiples = new int[4][2];     // 2D integer array with 4 rows 
                                          and 2 columns
String[][] cities = new String[3][3];  // 2D String array with 3 rows 
                                          and 3 columns
Posted by: Guest on October-01-2020
1

two dimensional array in java example program

class MultidimensionalArray {
    public static void main(String[] args) {

        int[][] a = {
            {1, -2, 3}, 
            {-4, -5, 6, 9}, 
            {7}, 
        };
      
        for (int i = 0; i < a.length; ++i) {
            for(int j = 0; j < a[i].length; ++j) {
                System.out.println(a[i][j]);
            }
        }
    }
}
Posted by: Guest on May-31-2020
1

two dimensional array in java example program

String[][][] data = new String[3][4][2];
Posted by: Guest on May-31-2020
0

two dimensional array in java example program

class MultidimensionalArray {
    public static void main(String[] args) {

        // create a 2d array
        int[][] a = {
            {1, -2, 3}, 
            {-4, -5, 6, 9}, 
            {7}, 
        };
      
        // first for...each loop access the individual array
        // inside the 2d array
        for (int[] innerArray: a) {
            // second for...each loop access each element inside the row
            for(int data: innerArray) {
                System.out.println(data);
            }
        }
    }
}
Posted by: Guest on May-31-2020
0

two dimensional array in java example program

int[][] a = new int[3][4];
Posted by: Guest on May-31-2020

Code answers related to "two dimensional array in java example program"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language