This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Interfaces and multiple inheritance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interfaces and multiple inheritance" Watch "Interfaces and multiple inheritance" New topic

Interfaces and multiple inheritance

John Lincoln
Ranch Hand

Joined: Feb 11, 2003
Posts: 192

Interfaces can extend more than one interface . Just want to why this exception for interfaces. Following code compiles

Dustin Johnson

Joined: Nov 14, 2006
Posts: 22
Are you asking why they can extend more than one? You're absolutely correct, the code compiles.

They can extend more than one because they are not exhibiting familial relationships, they are exhibiting BEHAVIOR. Just as in a ball can roll, it is Rollable, and a balloon can inflate, it is Inflateable, a tire has the same behavior as both of these so it could extend both Rollable and Inflateable. Behavior is a slightly different concept than inheritance.

[ March 08, 2007: Message edited by: Dustin Johnson ]
[ March 08, 2007: Message edited by: Dustin Johnson ]

SCJA 86%<br />SCJP 5.0 98%<br />SCWCD 1.4 79%<br />SCBCD 5.0 83%<br />--------------------------------<br />"I drank what???" - Socrates
It is sorta covered in the JavaRanch Style Guide.
subject: Interfaces and multiple inheritance
It's not a secret anymore!