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 / raman t
if we write like this then it would be better.
HashMap map = new HashMap();
map.add( "cat", "Meow" );
map.add( "ape", "Squeak" );
map.add( "dog", "Woof" );
map.add( "bat", "Squeak" );
System.out.println( "map = " + map );
| Is This Answer Correct ? | 2 Yes | 14 No |
Post New Answer View All Answers
Explain parallel processing in java8?
How to declare objects of a class ?
Which of the classes will have more memory allocated?
What is method overloading with type promotion?
Are arrays classes in java?
Write a java program to generate fibonacci series ?
What are thread safe functions?
What is difference between length and length() method in java ?
what is the swingutilities.invokelater(runnable) method for? : Java thread
What is jvm? How its run?
Can a constructor be made final?
What is object cloning in Java?
What is a return in java?
How will you add panel to a frame?
Explain the difference between comparator and comparable in java?