permaculture playing cards
The moose likes Beginning Java and the fly likes parent class for Java.util.Map Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "parent class for Java.util.Map" Watch "parent class for Java.util.Map" New topic

parent class for Java.util.Map

Deepika Saxena
Ranch Hand

Joined: Jul 05, 2009
Posts: 59
could any body let me know the parent class of java.util.Map interface? as per my knowledge it is java.lang.Object. Please correct me if i am wrong.
Rob Spoor

Joined: Oct 27, 2005
Posts: 20271

An iterface does not have a parent class. It can have multiple "parent" interfaces, if it extends multiple interfaces.

As for a class that implements Map, you can't tell its parent class without knowing the class. Some classes may have Object as the parent class, implementing Map completely themselves. Others may extend AbstractMap, inheriting some methods from it. Others may even extend an existing Map implementation. An example is java.util.Properties, which extends java.util.Hashtable which in turn extends java.util.Dictionary which in turn extends Object. In this hierarchy, only Hashtable and Properties are Maps.

How To Ask Questions How To Answer Questions
Jeanne Boyarsky
author & internet detective

Joined: May 26, 2003
Posts: 33102

Rob said everything I can think on the topic. Since it sounds like you are new to Java, it's probably also helpful to show you how to find this information yourself.

If you go to the JavaDoc for the Map interface, you can see the declaration is:

By contrast, the one for Hashmap is:

As you can see HashMap extends AbstractMap. And it's easy to find out once you know how!

[OCA 8 book] [Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
I agree. Here's the link:
subject: parent class for Java.util.Map
jQuery in Action, 3rd edition