Home Java Programming Language / Programs / Example of Multidimensional java array
🚀 Programming Example

Example of Multidimensional java array

👁 1,139 Views
💻 Practical Program
📘 Step Learning
Let's see the simple example to declare, instantiate, initialize and print the 2Dimensional array.
No previous program
No next program

💻 Program Code

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

//declaring and initializing 2D array
int arr[][]={{1,2,3},{2,4,5},{4,4,5}};

 //printing 2D array
 for(int i=0;i<3;i++){
   for(int j=0;j<3;j++){
     System.out.print(arr[i][j]+" ");
  }
  System.out.print("\n");
 }

 }
}
                        

🖥 Program Output

1 2 3
2 4 5
4 4 5
Press any key to continue . . .
                            

📘 Explanation

None
No previous program
No next program
📚 Learning Subject

Master Programming Through Practical Examples

Improve your coding logic, problem-solving skills and programming confidence by practicing real-world examples with explanations.

🎯 How to learn from this example

First understand the algorithm carefully. Then study the program line-by-line and compare it with the output. Finally, review the explanation section to strengthen your logic and programming understanding.

🔥 Practice suggestion

Rewrite the program without looking at the code. Modify values, conditions or logic and run it again. This helps improve confidence and strengthens coding skills much faster.