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
Why is core java important?
Can we convert integer to string in java?
How a variable is stored in memory?
How to sort elements in a parallel array in java?
What is hashing principle in java?
What do you understand by overloading and overriding in java?
What are structs in java?
What is heterogeneous in java?
What is bytecode in java ?
What is complexity in java?
How garbage collection is done in java?
What is the difference between an object-oriented programming language and object-based programming language?
Explain about serializable interface in java?
Can inner class be public in java?
What is unmodifiable collection in java?