Program To Demonstrate Multidimensional Arrays In Java

Hello friends, In this section of column we will look into an example, which will demonstrate the working of Multi-Dimensional Arrays in Java. Multi-Dimensional arrays in Java are widely used when it comes to deal with Matrix and all. The chess game is an good example of Multi-Dimensional usage. Checkers game is yet another cool example of Multi-Dimensional Arrays in Java.

What do we mean by Multi-Dimensional Arrays in Java ?.

Multi-Dimensional Arrays in Java are termed as arrays of arrays. Normal arrays are objects in Java, while if we talk about Multi-Dimensional arrays, those are array objects whose elements themselves store

array objects. Two Dimensional arrays are basic representation of tables having rows and columns. Thus, the information stored in two dimensional array is generally in rows and columns. Let us

look into a simple program that demonstrate Multidimensional Arrays in Java :-

package com.hubberspot.multidimensional.array.example;

public class TwoDimensionalArrayDemo {
public static void main(String args[]) {
int twoDArray[ ][ ]= new int[5][5];
int i, j, k = 0;

for(i=0; i<5; i++)
for(j=0; j<5; j++) {
twoDArray[i][j] = k;

for(i=0; i<5; i++) {
for(j=0; j<5; j++)
System.out.print(twoDArray[i][j] + " ");


For more of such hot topics read my other posts here :

Visit my new website

Article Written By jontymagicman

I am DInesh Varyani.

Last updated on 26-07-2016 143 0

Please login to comment on this post.
There are no comments yet.
How To Declare, Create And Access A One-dimensional Array In Java
Program To Demonstrate This Keyword To Find Area Of Rectangle