To test whether two objects are equal, a developer should provide an equals method. The logic in the method can determine if the two objects are equal and return true, or return false otherwise. To compare two objects with the equals method, follow these four steps.