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
How would you use Bubble Sort to sort the number of elements?
We are seeing so many videos/audios as many web sited. But question is these videos or audios are stored in Databases ( Oracle, Mysql, Sybase,... ) or stored any file directory from there they will give the link for that? Pls explain and give sample code to achieve this one? Thanks, Seenu.
when should you use stringbuilder class in a program?
What happens when a thread cannot acquire a lock on an object in java programming?
Explain try and catch keywords in java?
Can static method access instance variables ?
What is argument in java?
Will set allow duplicates in java?
Which is better 64 bit or 32 bit?
What is keyword auto for?
Explain about fail safe iterators in java?
What are the 6 boolean operators?
Difference between object instantiation and construction ?
Why put method is idempotent?
Why singleton class is used in java?