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 is the benefit of abstract class?
If a class is declared without any access modifiers, where may the class be accessed in java programming?
Can a constructor call another constructor?
What is java english?
Difference between ‘is-a’ and ‘has-a’ relationship in java?
Which is better singleton or static class?
What is null statement?
What exactly is java?
Is it possible to use string in the switch case?
What is the use of coding?
What is functional interface in java?
Is math class static in java?
Why to use nested classes in java?
Explain OOPs concept.
What are the practical benefits, if any, of importing a specific class rather than an entire package (e.g. Import java.net.* Versus import java.net.socket)?