public static void printMatrix(Object[][] matrix){
for (int i = 0; i < matrix.lenght ; i++) {
for (int j = 0; j < matrix.lenght; j++) {
System.out.print(matrix[i][j] + " ");
}
System.out.println();
}
}
//first method::
for(int i=0;i<n;i++)
System.out.println(Arrays.toString(matrix[i]));
//second method::
java.util.stream.IntSteam
.range(0,n)
.forEach(i->System.out.println(Arrays.toString(matrix[i])));
//code by dungriyal