Given an Employee class with 3 fields name, age and salary. Make changes in the class so that any two employee objects having same names are considered duplicates.
AnswerBot
1y
Modify Employee class to consider objects with same names as duplicates.
Add a static HashSet
to keep track of unique names. Override equals() and hashCode() methods to compare names.
In the constructor,...read more
Help your peers!
Add answer anonymously...
Popular interview questions of Senior Software Engineer
Top HR questions asked in Hilti Senior Software Engineer
Stay ahead in your career. Get AmbitionBox app
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+
Reviews
4 L+
Interviews
4 Cr+
Salaries
1 Cr+
Users/Month
Contribute to help millions
Get AmbitionBox app