Jeanne Boyarsky wrote:I don't know what I was thinking when I logged the errata. As you noted the JavaDoc clearly says that. Removed the errata.
Campbell Ritchie wrote:
I think that answers your questionJoão Victor Gomes wrote:. . . If the ID field is defined inside Vehicle class . . . the Van and Car classes should not have their own equals() method . . .
![]()
Three resources worth reading:1: Effective Java by Joshua Bloch pages 33‑50 2: Odersky Spoon and Venners 3: Angelika Langer Start with your standard book about equals(), then read those three links. That should get you well on the way to understanding equals().
Campbell Ritchie wrote:So, Vehicles usually have IDs, called registration numbers or license numbers depending where you are. If two Vehicle instances have the same ID, what is going to happen if you have the equals() method in the Car and Van classes? Should you allow the Van and Car classes to have their own equals() methods?
David Simkulette wrote:So could you define equal in the super class then defer to the super class in the subclass? You could, but since the super class is (obviously) not final how do you know you won't have yet another variant subclass of the superclass with new properties for which this won't work ?
Chivid Ram wrote:
1)Instance Methods can be called from another Instance method within a same class without reference variable.
Chivid Ram wrote:
2)Instance Methods can be called from another Instance method in child class without reference variable.
Chivid Ram wrote:
3)Instance Methods cannot be called from another Instance method which is outside the class without using reference variable.Here reference variable is used.
Chivid Ram wrote:
4)Static method cannot call Instance method without reference variable even within same class or different class.