Question

What happens if we put a (Key, Value) pair in a HashMap where the Key already exists? O The new value is discarded. The new value replaces the old value. The key is discarded. O An exception (eg. Key already exists) is thrown

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer: The new value replaces the old value

When the key exists in the HashMap, the old value is discarded and the new value is stored

Add a comment
Know the answer?
Add Answer to:
What happens if we put a (Key, Value) pair in a HashMap where the "Key already...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT