Meaningless Drivel is fun!*
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 OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Interfaces and multiple inheritance" Watch "Interfaces and multiple inheritance" New topic
Author

Interfaces and multiple inheritance

John Lincoln
Ranch Hand

Joined: Feb 11, 2003
Posts: 192
Hi,

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


Thanks
Dustin Johnson
Greenhorn

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
 
Don't get me started about those stupid light bulbs.
 
subject: Interfaces and multiple inheritance