-1

I have a matrix and few bottom lines of the matrix are same, so i wanted to just dont show them when i print the matrix. I tried 2 diffent aproaches but non of them works.

if (matrix[index] == matrix[index+1] {
    system.out.println("Next lines are same");
} 

and

if (matrix[index].equals(matrix[index+1]) {
    system.out.println("Next lines are same");
} 

After both ifs i add 1 to index as im showing lines of the matrix one by one

Ondra Jahoda
  • 23
  • 1
  • 5

1 Answers1

1

Try using:

 if (Arrays.equals(matrix[index], matrix[index+1]) ) {
                    ....
 }