| Author |
parent class for Java.util.Map
|
Deepika Saxena
Ranch Hand
Joined: Jul 05, 2009
Posts: 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 Spoor
Sheriff
Joined: Oct 27, 2005
Posts: 19216
|
|
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
Marshal
Joined: May 26, 2003
Posts: 26173
|
|
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]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
 |
|
|
subject: parent class for Java.util.Map
|
|
|