Question: When you implement equals in a subclass, you should first call equals in the superclass. Why? To ensure that the superclass constructor has already executed.
When you implement equals in a subclass, you should first call equals in the superclass. Why?
To ensure that the superclass constructor has already executed.
To chedk whether the objects being compared are instances of the same class.
To preventa bad cast and the possibility of an exception.
To check whether the superclass instance variables match.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
