How to check if an matrix (array) has a column that it's the same than a row
<p>I've been learning Java for three months in a grade, and now I'm redoing some exercises that we did before, and I'm doing one that I could not do it before.
The wording would be this:
Write a program that starts a matrhix of NxN through scanner and tells if exists a row exactlly the same than some column, joined the indexs of rows and columns that are the same.
For example, if we have the next bidimensional array:</p>

<pre><code>   0   1   2
0 [1] [2] [1]
1 [4] [8] [2]
2 [3] [5] [1]
</code></pre>

<p>The program would tell me than the row 0 it's the same than the column 2.
Sorry for my bad english, I'm spanish.
So this is the code that I did:</p>

<pre><code>package Arrays;

public class Ejercicio16 {



    public static void main(String[] args) {
            int matrix[][];
            int i, j;
            int rows, columns;
            boolean same = false;

            //1.Ask inf of the matrix to the user.
            do{ 
                rows = Teclado.nextInt("Insert the number of rows of the matrix");
                columns = Teclado.nextInt("Insert the number of columns of the matrix");    
            }while(rows&lt;=0 &amp;&amp; columns&lt;=0);

    /*Teclado = A java class that I use with methos like nextInt, nextByte, etc with their try catchs and so on.It would be a Scanner method*/


    matrix = new int[rows][columns];



    for (i=0; i&lt;rows; i++) {
        for (j=0; j&lt;columns; j++){
            matrix[i][j] = Teclado.nextInt("Insert a value for the cell of the row: "+ i + " column: " + j);
                        }
                    }

            //4. Show the matrix inserted by the user.
            for (i=0; i&lt;rows; i++){
                for (j=0; j&lt;columns; j++){
                    System.out.print( "[" + matrix[i][j] + "]" + " ");
                    }
                System.out.println();
            }

            checkEquality(matrix, rows, columns, same);




        }
        public static boolean comprobarIgualdad(int matriz[][], int filas, int columnas, boolean igual){
            int i, j;

            for (i=0; i&lt;rows; i++){
                for (j=0; j&lt;columns; j++){
                    if(matrix[i] == matrix[j])
                        same = true;
                    else
                        same = false;
                    }

            }
            return same;





        }

    }
</code></pre>

<p>Now, my problem is: I don't know how to make the method to go overthe matrix vertically and horizontally and check if they are the same. I've been thinking these days but I couldn't find the answer, so I thought asking here for some help. I would like to make this problem by myself, but I think I can't, so any help is well received. If you have any ask about my code, just let me know!</p>