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

How do you access command-line arguments within the code?

573


What is bytecode in java ?

611


What is the default execution method in java?

626


Does java map allow duplicates?

497


Explain public static void main(string args[]) in java.

537






How do you sort data in java?

527


What is empty list in java?

629


What are the advantages of exception handling?

558


what is heap memory?

660


Is arraylist an object in java?

605


what is function overloading in java?

702


Which package has light weight components?

568


How do you convert bytes to character in java?

539


how we can make a read-only class in java?

544


What are the states of thread in java?

519