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
write a program that list all permutations of ABCDEF in which A appears before B?
What do you understand by the term polymorphism?
What is the difference between the paint() and repaint() methods in java programming?
Can we override constructors in java?
Difference between string s= new string (); and string s = "abv";?
What is bytecode in java ?
What is the syntax and characteristics of a lambda expression? Explain
What is the purpose of final keyword and when to use it?
What is jvm? How its run?
what is a green thread? : Java thread
What is the base class of all exception classes in java?
What is array and arraylist in java?
Is cout buffered?
Explain a situation where finally block will not be executed?
What best practices should you follow while writing multithreaded code in java?