Sozziko
Sozziko

Reputation: 129

2D Arrays: Retrieving Row/Column and not value

I'm wishing to compare an array with itself, so it doesn't process a certain body of code unless the coordinates are different. For example:

if (one [a][b] == two [c][d]) 
{
    //Do Nothing
}

else 
{
    System.out.println(one [a][b]);
}

What I want to do is to compare the coordinates used ([a][b] and [c][d]), and not the value of what the element of one or two is. Is there a way to do this?

Upvotes: 1

Views: 108

Answers (1)

Kiith Nabaal
Kiith Nabaal

Reputation: 466

If you want to just check indicies, why not just do that? Just make a pair of variables for one array say: arrOne_col and arrOne_row, and then do the same for the other and compare their values.

Upvotes: 1

Related Questions