== (and by extension != ) check the identity of the object, that is, if both objects belong to the same instance. equals tests the concept of a higher level identity, usually whether the โvaluesโ of objects are equal. This means that anyone who implemented equals on this particular object. Therefore, they are not the same thing.
A common example where these two are not the same are strings in which two different instances can have the same content (the same character string), in which case the comparison == false, but equals returns true.
The default implementation of equals (on Object ) uses == internally, so the results will be the same for objects that do not override equals (excluding zeros, of course)
source share