The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
December 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.



Posted by Matt Gerrans on February 01, 2002 at 4:16 PM

> If the the interface can extend more than one interface what is
> the order of inheritence.For example if
> Interface1 extends Interface2,Interface3
> Which is the parent

There isn't really any order to worry about here (as far as the sibling inrefaces go). The interface is really just a way of codifying what methods the derived class must have. Since the interfaces don't define the methods, you don't have that multiple inheritance dilemma where you are wondering which implementation of foo() will be called if two of the superclasses implement it. In the case you have, when you eventually have a class that implements Interface1, you could refer to it with either of the other two superinterfaces you have defined, without ever having to worry about precedence. Of course, that implementation will have to implement the all methods included in all the interfaces. If the same method signature is included in two of interfaces, it doesn't really matter.


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us