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
What are classloaders?
what is a thread pool in java and why is it used?
How arrays are stored in memory in java?
What are the important features of Java 9 release?
What is the collections api in java programming?
Why is java so popular?
What is a bubble sort in java?
Can a class extends itself in java?
How to make a write-only class in java?
What is the null?
What is a singleton class in Java?
What is the difference between preemptive scheduling and time slicing?
What is the do while loop syntax?
What differences exist between iterator and listiterator?
Can an unreferenced object be referenced again?