is it possible to add a object in a HASHMAP

Answer Posted / janardhan

yes we can add object in Hashmap

example:--

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

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

here l is object

Is This Answer Correct ?    4 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we override constructor in java?

815


In which order the iterator iterates over collection?

785


What is boolean data type in java?

770


What is thread synchronization in java?

669


Is array a class in java?

730


Define a package.

777


Explain the difference between jvm and jre?

795


What is Classloader in Java?

836


Does java support Operator Overloading?

829


How does finally block differ from finalize() method?

814


Why lambda expression is used in java?

777


Can a static class have a constructor java?

743


What is the importance of main method in Java?

808


How do you convert bytes to character in java?

737


Howto get an object that will perform date & time calculations then format it for output in some different locales with different date style.can ne1 tel me the answer of this question.pls

1681