# How to Create Create Matrix of any order

In this section, you will learn how to create a matrix of any order Using Java Programming.

In this section, you will learn how to create a matrix of any order Using Java Programming.

# Create Matrix of any order Java Program

A matrix is a rectangular array of numbers.The numbers in the matrix are called its entries or its elements. A matrix with m rows and n columns is called an m-by-n matrix or m � n matrix, while m and n are called its dimensions.Here we have allowed the user to enter the number of rows and columns and the elements they wish to be in the matrix.

2x2 Matrix:
1 2
3 4
3x3 Matrix:
1 2 3
2 3 4
4 5 6

Here is the code:

```import java.io.*;
import java.util.*;

public class matrix {
public static void main(String[] args) throws IOException {
int[][] dim = new int;
System.out.println("Enter the rows of matrix : ");
System.out.println("Enter the columns of matrix : ");

int[][] A = new int[dim][dim];
for (int i = 0; i < A.length; i++)
for (int j = 0; j < A[i].length; j++) {
System.out.println("Enter element ("+(i+1)+","+(j+ 1)1)+"): ");