Multiple uses of "this" keyword in Java
- by frodosamoa
So, I have this. It compares two card decks and if they are the same the result is true.
public boolean equals ( Object obj ) {
boolean result = true;
for (int i = 0; i < 52; i++) {
if (this.cardAt(i) = this2.cardlist(i)) {
result = true;
} else {
result = false;
}
}
}
I would like to be able to compare two random card decks, if you will.
But I don't know how to compare two different ones using "this .
I simply wrote "this2" to replace another instance of "this".
What could I do to replace this "this2" to still be able to compare two card decks?