Java Program to multiply two matrices

We can multiply two matrices in java using binary * operator and executing another loop. A matrix is also known as array of arrays. We can add, subtract and multiply matrices.

In case of matrix multiplication, one row element of first matrix is multiplied by all columns of second matrix.

Matrix Multiplication in Java

Let's see a simple example to multiply two matrices of 3 rows and 3 columns.

Test it Now

Output:

6 6 6 
12 12 12 
18 18 18 
Next TopicJava Programs


Latest Courses