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 is concurrent hashmap and its features?
Why we use protected in java?
Define Multiprogramming and Multiprocessing in java.
Explain a few methods of overloading best practices in java?
Can a function return a function?
What is charat java?
What is the string function?
What is Classloader in Java?
How does callback work in java?
Explain the difference between the public, private, final, protected, and default modifiers?
What is a copy constructor in java?
What language is an assembler written in?
What are the differences between Java 1.0 and Java 2.0?
Why we use multi threading instead of multiprocessing?
Explain java coding standards for constants?