This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Beginning Java and the fly likes Interface inheritace Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Interface inheritace" Watch "Interface inheritace" New topic
Author

Interface inheritace

sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1087
is that true interface doesn't support inheritance?
then what happen when we extends one interface to another
Hector Tenedero
Ranch Hand

Joined: Oct 13, 2008
Posts: 31
This should clear things out
sam liyanage
Ranch Hand

Joined: Nov 25, 2008
Posts: 1087
No,i didn't get the answer
is interface support inheritance
tell me "yes or no"
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14114
    
  16

An interface can extend another interface, and so an interface can inherit method signatures from another interface. So yes, interfaces do support inheritance.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
Larry Frissell
Ranch Hand

Joined: May 16, 2008
Posts: 82
    
    2
Jesper, I am not sure that I agree, I guess the answer would depend on the meaning of "inheritance". In the Sun tutorial in the discussion of inheritance it states "Object-oriented programming allows classes to inherit commonly used state and behavior from other classes". In the discussions of interfaces they use the term "extends" when they rewrite the interface, but not inherit.

My point is that you can add methods to an interface, but you can not inherit the state or behavior.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Interface inheritace