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
Does isempty check for null?
How do you print array in java?
Why main function is static?
What is api data?
What is derived datatype?
Is java programming easy?
What is the purpose of the finally clause of a try-catch-finally statement in java programming?
when to use ArrayList and when to use HashMap in webApplication.
What is the purpose of garbage collection in java?
What is a void method?
Does string is thread-safe in java?
What does isempty () do in java?
How are the elements of a gridbaglayout organized?
Is 64bit faster than 32 bit?
If two threads have same priority which thread will be executed first ?