Java - Collections - Interview Questions and Answers on Key-Value

Q1.  Difference between TreeMap and HashMap ?

Ans. They are different the way they are stored in memory. TreeMap stores the Keys in order whereas HashMap stores the key value pairs randomly. 

Q2.  Which interface provides the capability to store objects using a key-value pair?

Ans. java.util.map