Path: csiph.com!eternal-september.org!feeder.eternal-september.org!mx02.eternal-september.org!.POSTED!not-for-mail From: Jeff Higgins Newsgroups: comp.lang.java.programmer Subject: Re: can you give me some hints on the Oracle Java SE related certificates? Date: Wed, 23 Sep 2015 10:54:07 -0400 Organization: A noiseless patient Spider Lines: 65 Message-ID: References: <92ec7821-b17d-4af8-9c99-8a7649fa64ec@googlegroups.com> <4245d965-6d79-4bdf-accd-dc51520d3273@googlegroups.com> <313f817e-9d7c-4939-a971-7e2b2a85d35f@googlegroups.com> <430f5ded-3382-476a-ae5e-ef12427e1542@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Wed, 23 Sep 2015 14:53:52 +0000 (UTC) Injection-Info: mx02.eternal-september.org; posting-host="a78aad8b483612fbf45d18e918df0cca"; logging-data="25013"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/z4hFLZG8NFVPVV4m4uZ8XOv6d2Cdfqzc=" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.8.0 In-Reply-To: Cancel-Lock: sha1:bSGbj/759NjBRWihhnmU/KUBveI= Xref: csiph.com comp.lang.java.programmer:32642 On 09/23/2015 09:43 AM, Eric Sosman wrote: > On 9/23/2015 9:25 AM, Sebastian wrote: >> Am 22.09.2015 15:50, schrieb Jerry Stuckle: >> [snip] >>> Multiple inheritance can be a very useful technique - one that I have >>> used occasionally in C++. The biggest problem I've seen with it is >>> misuse. But it's one I definitely miss in Java. >>> >> I think so far it has not been mentioned in this thread that Java does >> have indeed multiple inheritance of behavior with default methods in >> interfaces, since Java 8. > > Only to the same extent as in earlier Java versions, though. > All that Java 8 added was default implementations of the specified > methods, not the (potential) multiple inheritance. > > That is, even in Java 1 you could get into trouble: > > interface Muggle { > void spell(String word); > } > > interface Wizard { > void spell(String charm); > } > > class Rowling implements Muggle, Wizard { > // Which kind of spell() should I implement? > } > > ... or even worse: > > interface Machine { > /** Operate the machine. */ > void operate(); > } > > interface Surgeon { > /** Return true iff the patient survives. */ > boolean operate(); > } > > class Autodoc implements Machine, Surgeon { > // This class cannot be written > } > From the JLS 8: Example 8.1.5-3. Illegal Multiple Inheritance of an Interface interface I {} class B implements I {} class C extends B implements I {} Class C causes a compile-time error because it attempts to be a subtype of both I and I. Bringing the overloaded term "Multiple Inheritance" into a beginning Java programming course in a fashion such as "No multiple inheritance in Java" and all of its variants is harmful. If you have to bring it in at least do it as in the example provided by the Java tutorials. If a particular student needs more information point him to it and carry on. That is my opinion.