Search Interview Questions | ![]() ![]() Click here and help us by providing the answer. ![]() Click Correct / Improve and please let us know. |
|
| ||||
Interview Questions and Answers | ||||
| ||||
Ans. equals is the method of Object class that is overridden by the classes to specify object equality criteria. As every class extends Object class, the default implementation of equals is carried to them. Default implementation specified in the Object class is that two objects are treated equal if they are same. i.e Object x = new Object(); Object y = new Object(); x.equals(y); // false x=y; x.equals(y); // true i.e x.equals(y) if only x==y Now every class has the option to specify their object equality by overriding equals method. For example - String class has implemented in a manner if the string value contained in them is exactly same. | ||||
![]() | ||||
![]() ![]() ![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||
![]() | ||||