How to Implement Multidimensional Array in Java


In this example we will show the method to implement multidimensional array in Java.

Source Code

package com.beginner.examples;

public class MultidimensionalArray {
  public static void main(String[] args) {
    int[][] nums = { {1, 3, 4}, {2, 5}, {5, 6, 8} }; // multidimensional array
    int x = nums[1][0];
    System.out.println(x);
  }
}

Output:

2
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments