Memory


When it comes to equals, it should have the method, for instance, for remove. Needed for an array search, since most of it is based on if it is equal or not.


When ti comes to object classes, it’s best to override a toString and equals method.


For it, since it is a object method, it will have this, which is the first object, and obj, which is the second one. That way, you don’t have to use two parameters for it.

                    Two great example of how to Build the Equals Method

(better one, well not really, just said so)


Using the autoboxing concept, you can use it to cast it to person.


When it comes to casting, it is needed, hence you can compare it. Can’t compare two different types, even if it the object are the same.


If the first one is null, you can’t just compare it to another object. Since it is null, it doesn’t have access to those methods.


With getClass(), ≠ and = can work, might also return a Class name, instead of a string name.


equals should be transitive(a=b, b=c, a=c, also associative with b=a)


With the example, it compares vehicle to car, not other way around


MEmory Overview.