Binary relation interface
There are a couple of things in here that concern me.... but, the most concerning is:

Use .equals() to compare String values

Code like this:


if(basket[i][0]==X){



will fail when you get data that is not String-constant data.

That line should be:

 if(basket[i][0].equals(X)){


This problem is found all over your code.



In addition, there are other problems:


your arrays are pre-sized. This code:


String[][] basket = new String[16][2];



is potentially OK if you are initializing the array, but what if there are more than 16 pairs?
it would be better to create a 'Pair' class to contain your two strings, than to use the 2-size array on the basket. Then your basket could be something like:

StringPair[] basket = new StringPair[SIZE];


your StringPair class could look something like:

public class StringPair {
    private final String first, second;

    public StringPair(String first, String second) {
        this.first = first;
        this.second = second;
    }

    ..... getFirst() .....
    ..... getSecond() .....

}

compare(String[][] that, String[][] ths) is a method that needs no state data. It should be a static method, or a utility method. Alternatively, it should be a simple 1-value method compare(MyClass that) ... which, for what it is worth, would be very similar to the equals(...) method.

but, that method is pretty broken. It has the two input parameters that and ths, but it then overwrites those values with the internal versions bag and basket.


that = basket;
ths = bag;
boolean equal;

if(that.equals(ths))
    equal = true;
else
    equal = false;
return equal;



now, since you set bag = basket earlier, this will always return true.

Further, that last 5 lines of the method can be replaced with:

return (that.equals(ths));