You'll find the link for "mark this thread solved" at the end of the thread.
You override equals for a class where you want different objects to be treated as equal according to some criteria that you define. Eg two Strings are equal if they contain exactly the same sequence of characters. It's up to you to decide exactly what values you want to compare before you decide that two objects are "equal"
I don't understand your last question about "only one code"