how do you store phone numbers using java collections

Answer Posted / shahnawaz sheikh

Using HashMap.. can be one of the way.

HashMap hs = new HashMap();

hs.put("amit","989213232");
hs.put("john","989211422");
hs.put("Alex","989214578");

Is This Answer Correct ?    6 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can a static class have a constructor?

515


What does the append?

491


what is recursion in java

596


explain local datetime api in java8?

551


Can you sort a list in java?

520






Justify your answer that you can't define a method inside another method in java, if you can then how?

600


Explain the difference between protected and default access.

511


How will you get the platform dependent values like line separator, path separator, etc., ?

579


Can you access the private method from outside the class?

505


What are the uses of synchronized keyword?

551


What happens if a constructor is declared private?

529


Is intellij better than eclipse?

537


What is namespace in java?

541


Explain the difference between map and flatmap stream operation?

814


What is numeric function?

537