is it possible to add a object in a HASHMAP

Answer Posted / venkat

yes we can add object in Hashmap

like the example is

ArrayList list=new ArrayList();
list.add(10);

HashMap map=new HashMap();
map.put(list,"13");

here list is object

Is This Answer Correct ?    15 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of methods are there in java?

775


What is the static field modifier?

843


What is keyword auto for?

911


Do loops java?

775


What is multi-catch block in java?

845


What do you understand by copy constructor in java?

735


Does .length start 0 java?

770


What is Hierarchy of exception?

864


What is the difference between a field variable and a local variable?

797


Explain the difference between comparator and comparable in java?

704


How do you add an element to a hashset in java?

710


What are the two environment variables that must be set in order to run any java programs?

740


What is the common usage of serialization? What exceptions occur during serialization?

827


What is string pooling concept?

792


Is java still relevant?

744