Map map = new HashMap(2);
map.add(“1”,”one”);
map.add(“2”,”two”);
map.add(“3”,”three”); What will happen at this line?
Answer Posted / haneef
see, there is no add() in the Map, so u will get compilation
error.
there is only put();
Is This Answer Correct ? | 22 Yes | 0 No |
Post New Answer View All Answers
What is difference between equal and == in java?
What is tostring () method?
What is the purpose of abstract class?
What is java in detail?
Is java still necessary?
What do you mean by scope of variable?
FOR EXAMPLE WE R HAVING TWO LIST ELEMENTS ..BOTH LISTS CONTAINS ID,NAME,PLACE ..I NEED TO COMPARE BOTH IDS IN TWO LISTS,IF ID'S R SAME MEANS WE HAVE ADD THE DETAILS(LIKE NAME,PLACE) TO MAP...HOW IS POSSIBLE ?CAN ANY ONE SUGGEST?
What is a stack class in java ?
What is the use of optional ?
What is contract between hashcode and equal method?
What is string variable?
If we don’t want some of the fields not to serialize how to do that?
What are the two ways of implementing multi-threading in java?
Can we use both this () and super () in a constructor?
What is the buffer limit?