Tag Info

New answers tagged

1

My insight in this matter might not qualify for a full answer, but I think you are comparing to valid approaches, who's differences aren't a matter of style, but of solving different problems. If you fear of trying to do C# in Javascript, maybe you should start by questioning a more essential premise of yours: In my app, obviously I need objects. ...


1

To give a short answer to your short question - it's because the equals() function defined for java.lang.Object is largely useless. It's just equivalent to "==" in that it returns true if the two references refer to the same object, and doesn't really test if they are "equal" in the normal sense of the word. Thus, if you actually want to compare two ...


3

Simple argument against your logic is, what is the use of the equals method if it's modified to be a final. Then it would execute same logic against any given objects. If you want to compare A and AX in the object class what would be the logic? Overriding of final method is allowed to be able to verify if two different objects (living in 2 different memory ...


2

equals() is a byproduct of an attempt to improve C++ when it was created. C++ has operator overloading which allows you to perform custom operations when called with otherwise valid operators such as <, >, !=, ==, and even =. The team made the decision (wisely so) to make equality be class method rather than having external static methods as it was done ...



Top 50 recent answers are included