IntelliJ open source
[Logo] JavaRanch » JavaRanch Saloon
  Search | FAQ | Recent Topics | Hot Topics
Register / Login


Win a copy of Flex 4 in Action this week in the Flex forum!
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Beginning Java
 
RSS feed
 
New topic
Author

parent class for Java.util.Map

Deepika Saxena
Ranch Hand

Joined: Jul 05, 2009
Messages: 59

Hi,
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.
--Deepika
Rob Prime
Bartender

Joined: Oct 27, 2005
Messages: 8788

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.

SCJP 1.4 - SCJP 6 - SCWCD 5
How To Ask Questions How To Answer Questions
Jeanne Boyarsky
internet detective
Sheriff

Joined: May 26, 2003
Messages: 17162

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!

[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]

"The set strikes me as something like the set of potatoes, radishes, farming, and lunch. " - a colleague's way of comparing both overlapping and disparate groups. made me laugh and thought of the ranch
 
 
 
Reply Bookmark it! Watch this topic JavaRanch » Forums » Java » Beginning Java
 
RSS feed
 
New topic
JProfiler
Get rid of your performance problems and memory leaks!