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 / sreekanth madamanchi
We don't have a method add() in HashMap.
We have put().
Map map = new HashMap(2);
map.put("1","one");
map.put("2","two");
map.put("3","three");
System.out.println("Size of the map="+map.size());
If we wrote like this, it will extend the size.
The out put is: Size of the map=3
| Is This Answer Correct ? | 18 Yes | 2 No |
Post New Answer View All Answers
How do you use wildcards?
What is a Presistent Object?
What is the mapping mechanism used by java to identify IDL language?
How many decimal places is a double?
What is a pointer and does java support pointers?
What is a function easy definition?
Why does java does not support multiple inheritance? Explain
Can we override compareto method?
What is a return in java?
What is meant by distributed application? Why are we using that in our application?
How to calculate the length of a singly linked list in java?
What is data string?
Is java developer a good career?
What is skeleton and stub?
What is the maximum length of a url?