If we try to add duplicate key to the HashMap, What will happen ?
a. It will throw an exception. b. It won't add the new Element without any exception. c. The new element will replace the existing element. d. Compiler will identify the problem and will throw an error.
More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Q1. If we try to add duplicate key to the HashMap, What will happen ?
a. It will throw an exception. b. It won't add the new Element without any exception. c. The new element will replace the existing element. d. Compiler will identify the problem and will throw an error.
Ans. The new element will replace the existing element.
Help us improve. Please let us know the company, where you were asked this question :