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       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
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
Can we place the any object to key attribute of
HashMap<key,value>?
 Question Submitted By :: Ramaraok
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Can we place the any object to key attribute of HashMap<key,value>?
Answer
# 1
Yes we can use object as the key 

person p = new person();

HashMap m = new HashMap()
m.put(p,"mysqlf");
above works perfectly fy9 ..... but dont try to use the same
object as key twice :-)
 
Is This Answer Correct ?    2 Yes 1 No
Patil Abhijeet
 
  Re: Can we place the any object to key attribute of HashMap<key,value>?
Answer
# 2
yes, we can place any object as key value but that object
must and should implement the hashcode method.
 
Is This Answer Correct ?    0 Yes 1 No
Ramarao Katta
 
 
 
  Re: Can we place the any object to key attribute of HashMap<key,value>?
Answer
# 3
Hi Ramarao,
Its not necessary to override hashCode() since hashcode is
default generated for every object. Please try my example n
check it by urself
 
Is This Answer Correct ?    1 Yes 0 No
Patil Abhijeet
 

 
 
 
Other Core Java Interview Questions
 
  Question Asked @ Answers
 
class{ ... ... interface myinterface{ ... ... } abstract class{ .. .. } ... .. .. } is this possible to write "Interface and/ or Abstract class inside a class ? if possible whcich one is possible is only interface? is only abstract? Logica-CMG2
can we Connect Applet to Data Base ? with Discriptiom. and also What is Diff. from Applet & Servlet? Systematix1
What is the use of Getters and Setters method ?  2
what is the difference between a java object reference and c++ pointer?  3
Hi Friends, Can u give few interview questions which relates ArrayList and Hashmap. I mean how to link ArrayList and HashMap.I know this is not good way of asking questions like this , but i need Microsoft1
Explain difference between final, finally and finalize?  2
I have a Arraylist object, it has duplecate values also. Now question is i want delete duplecate data in that objet with out using Set? Aricent5
What is dynamic binding?  2
In Serialization, whether you will use Static variables? HCL2
Instead of writing Home, Remote Interfaces if i directly extends EJBObject to bean class what happens? Flextronics1
How will you convert an ArrayList to Arrays? KPIT3
What is the difference between static and non-static variables?  2
Same common question what is Map,Set,HashMap,List???? Symphony3
what is polymorphism? Zensar5
what is the use of servlet engine? Photon2
What is exception and error? and what is the difference between them?  2
Can we add two byte variables and assign the result to a byte variable ? b=b1+b2 where b,b1,b2 are byte types TCS3
explain about casting of objects?  4
is this possible to create an array of 0 length? if so how? if not so why? coz we have an array in main() likw this "static void main(String [] s) then what it signifies? Hexaware2
What is the range of the char type?  2
 
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