Question: Assume that a Person has data fields lastName and firstName. Write an equals method that returns true if two Person objects have the same first
Assume that a Person has data fields lastName and firstName. Write an equals method that returns true if two Person objects have the same first and last names. Write a hashCode method that satisfies the hashCode contract. Make sure that your hashCode method does not return the same value for Henry James and James Henry. Your equals method should return a value of false for these two people.(equals method and hashCode method)
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
