-
What happens if we put a key object in a HashMap which exists?
-
- The old object is removed from the map
- It throws an exception as the key already exists in the map
- The new object replaces the older object
- The new object is discarded
- None of these
Correct Option: C
HashMap always contains unique keys. If same key is inserted again, the new object replaces the previous object.