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 / haneef

see, there is no add() in the Map, so u will get compilation
error.

there is only put();

Is This Answer Correct ?    22 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the purpose of the wait(), notify(), and notifyall() methods? : Java thread

561


Why Do I Get A "permission Denied" Error After Downloading The .jnlp Java Launcher For The Vkvm?

627


What is the access scope of a protected method?

562


How does queue work in java?

531


How many types of classes are there in java?

521






What is an object class?

557


What is a parameter in java?

547


Is there a case when finally will not execute?

565


What is sorting algorithm in java?

523


What do you mean by order of precedence and associativity?

546


Explain about OOPS concepts and fundamentals.

596


What does super keyword do?

559


In java, how many ways you can take input from the console?

519


Can we change the scope of the overridden method in the subclass?

846


Why is the main method static?

600