wood burning stoves
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 OCA Java SE 8 Programmer I Study Guide 1Z0-808 this week in the OCAJP 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
I agree. Here's the link: http://aspose.com/file-tools
subject: Interfaces and multiple inheritance