A technical aptitude question
HashMap<String, String> map = new HashMap<String,String>();
String key1 = "key1";
map.put(key1, "value1");
String key2 = key1.clone();
map.put(key2, "value2");
What are the contents of the map object?
I answered it as {key1=value2} but later realized that String doesn't contain clone method.
I wanted to know the reason for the same.