Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java Interface solves Deadly Diamond of Death??

843789Jun 3 2010 — edited Jun 6 2010
I'm new to Java and am studying Head First Java, 2nd Ed. It has stated that Interfaces are Java's solution to the Deadly Diamond of Death and I'm missing something important... it could be I'm not fully understanding the Deadly Diamond of Death scenario. The book sets it up as a superclass with two subclasses that are in turn superclasses for another class with multiple inheritance - the two superclasses inherit and both override a method and the ultimate subclass can't discern between the two. My question is why can't a very similar situation develop in Java when a class inherits a method from a superclass and implements an interface specifying a method of the same name? The class has to implement the interface method - is it coincidence whether that implementation becomes an override or an overload or is illegal - it seems like I could imagine method signatures between an inherited method and the interface method of the same name that would result in each possibility. I'm obviously missing something - if anyone can shed some light on the subject I would appreciate it very much. Thanks.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 4 2010
Added on Jun 3 2010
4 comments
780 views