ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Software  >>  Core Java  >>  Java J2EE  >>  Java Related
 
 


 

 
 Core Java interview questions  Core Java Interview Questions
 Advanced Java interview questions  Advanced Java Interview Questions
 Swing interview questions  Swing Interview Questions
 EJB interview questions  EJB Interview Questions
 Servlets interview questions  Servlets Interview Questions
 Struts interview questions  Struts Interview Questions
 JDBC interview questions  JDBC Interview Questions
 JMS interview questions  JMS Interview Questions
 SunOne interview questions  SunOne Interview Questions
 J2EE interview questions  J2EE Interview Questions
 Weblogic interview questions  Weblogic Interview Questions
 Websphere interview questions  Websphere Interview Questions
 Java Networking interview questions  Java Networking Interview Questions
 Java J2EE AllOther interview questions  Java J2EE AllOther Interview Questions
Question
how do you store phone numbers using java collections
 Question Submitted By :: Sudheer
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how do you store phone numbers using java collections
Answer
# 1
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 ?    0 Yes 0 No
Shahnawaz Sheikh
 
  Re: how do you store phone numbers using java collections
Answer
# 2
Shahnawaz Sheikh---sorry to say but don't you think that ur
ans is having some flaw...u r correct that phone no can be
store in HasMap but u have taken name as key but name can be
repeated while ph no is unique so don't u think that phone
no should be key in upper hash map.
 
Is This Answer Correct ?    2 Yes 0 No
Ankur Dhoot
 
 
 
  Re: how do you store phone numbers using java collections
Answer
# 3
We will have to assume that the names are going to be 
unique. We may have a situation, that one number is common 
for husband & wife or between friends etc. I mean, there is 
a possibility, right? And normally you get the name of the 
person and you have to find the phone number (I dont think 
its going to be the other way round...in normal cases). 
Then we need to have the name as the "Key", rather than 
as "Value". Let me know, your thoughts on the same. Thanks.
 
Is This Answer Correct ?    0 Yes 0 No
Sunny
 
  Re: how do you store phone numbers using java collections
Answer
# 4
Sorry,sunny i am not agree with your scenario that one
number is common for husband & wife or between friends
etc.It is not real life scenario, phone no. are always
register with single person name ,that might be possible two
or many persons have
name,if we use HashMap , the Key might be different than
name  like empid or securityid or some unique parameter.
Thanks
 
Is This Answer Correct ?    0 Yes 0 No
Saikatk
[Zensar Technologies]
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
What is object  6
How can be define MARKER interfce in java  1
where is .equals() method and how is it different from == operation <giving some confusing implementation> Is hashing related to these? iFlex4
Name the class that used to read objects directly from a stream? Wipro2
Iterator in the HashMap is fail-safe means what? IBM9
Difference between Array and vector?  4
what is filters and its use? Virtusa2
We can write any Java Logics in our JSP. Then why we are using servlets(Controller Layer) to interact with the DAO ? TCS2
What is thread? BMC5
What is Locale class? MySoft1
Which containers use a FlowLayout as their default layout?  3
Have you used any version control ? if so explain about it?  1
how can we import the user defined package without classpath?  1
What for read() function?  3
What are virtual methods? TCS1
what is request processor? Virtusa1
basic difference b/w ALL types of JDBC driver. Systematix1
how can we synchronize Hash map? CTS3
What is the Set interface?  2
How to create an instance of a class without using "new" operator? Plz help me out properly.Thank u. CSC8
 
For more Core Java Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com