Java Interview Questions - OOP
Here are the most popular Java interview questions about OOP.
See all questionsWhich methods need to be implemented in an object for it to be used as a Key in a HashMap or HashSet? Briefly explain their use. What are the requirements on these methods for the HashMap or HashSet to work correctly?
The two methods required for correctly using any type as a Key in a HashMap or HashSet are hashCode and equals.
...