equals() method

When you really need to know if two references are identical, use ==. But when you need to know if the objects themselves (not the references) are equal, use the equals() method(which you may need to override).Comparing two object references using the == operator evaluates to true only when both references refer to the same ...