Can we place the any object to key attribute of
HashMap<key,value>?
Answer Posted / patil abhijeet
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 ? | 5 Yes | 6 No |
Post New Answer View All Answers
What classes of exceptions may be caught by a catch clause in java programming?
Explain numeric promotion?
What are the main features of java?
What does it mean to flush a file?
What is meant by class loader? How many types are there?
Can a abstract class be declared final?
How to create com object in Java?
What is a 16 bit word?
How are variables stored in memory?
Are generics important java?
List down the methods and interfaces of collection class in java.
What is the purpose of tostring() method in java?
What is the maximum size of a string in java?
Why heap memory is called heap?
What is protected access modifier?