What is difference between equals and ==?

devquora
devquora

Posted On: Dec 26, 2020

 

The difference between equals and == are as follows:

S. N.==equals() method
1== is an operator.equals() is a method of Object class.
2== should be used during reference comparison. == checks if both references point to the same location or not.equals() method should be used for content comparison. equals() method evaluates the content to check the equality.
3== operator can not be overridden.equals() method if not present and Object. equals() method is utilized, otherwise it can be overridden.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions