Page 1 of 1

About Question enthuware.ocajp.i.v8.2.1479 :

Posted: Thu Jan 14, 2021 2:07 pm
by Denyo1986
The explanation is great, but a little inaccurate in one part if I am not mistaken. It says:
However, you still cannot have a class that implements two interfaces where both the interfaces contain a default method with the same signature unless the class provides an implementation for that method itself.
which may be true in general, but there is the special case that these two interfaces have a relationship (i.e. one extends the other). In that case, the code would compile fine (as was proven to me (the hard way :P) in another question).

I would suggest to add this exceptional case to the description just to make it complete

Re: About Question enthuware.ocajp.i.v8.2.1479 :

Posted: Fri Jan 15, 2021 12:48 pm
by admin
Right. Added.
thank you for your feedback!

Re: About Question enthuware.ocajp.i.v8.2.1479 :

Posted: Fri Jan 15, 2021 1:41 pm
by Denyo1986
Thank you for helping me to pass the exam :)

Re: About Question enthuware.ocajp.i.v8.2.1479 :

Posted: Fri Jan 15, 2021 10:46 pm
by admin
Congratulations on passing!!

Re: About Question enthuware.ocajp.i.v8.2.1479 :

Posted: Tue Jan 31, 2023 12:47 pm
by noeloo
Therefore, volatile, transient, and synchronized do not make sense for such fields.
Putting the sense aside, isn't it impossible for a field to be declared synchronized itself? If I'm right, I feel like this should be added to the description.

Re: About Question enthuware.ocajp.i.v8.2.1479 :

Posted: Tue Jan 31, 2023 8:36 pm
by admin
What happened when you tried it out ?

Re: About Question enthuware.ocajp.i.v8.2.1479 :

Posted: Tue Dec 26, 2023 10:54 pm
by Double-O-Jim
Maybe I'm being too literal, but the compiler error necessarily indicates that multiple implementation inheritance is not allowed. Your example and description even point that out. Multiple interfaces (regardless of whether they are related or not) with default methods of the same signature is not allowed to compile. How is
Interfaces allow multiple implementation inheritance through default methods.
considered a true statement?


Additionally, you might add to the description of the 3rd answer choice
All methods in an interface are abstract although you need not declare them to be so.
that private and static methods are also implicitly not abstract.
JLS 17 page 353 (chapter 9 section 9.1) it states:
An interface method lacking a private, default, or static modifier is implicitly
abstract. Its body is represented by a semicolon, not a block. It is permitted, but
discouraged as a matter of style, to redundantly specify the abstract modifier for
such a method declaration.

Re: About Question enthuware.ocajp.i.v8.2.1479 :

Posted: Wed Dec 27, 2023 8:47 pm
by admin
Multiple implementation inheritance doesn't necessarily mean inheritance of a method with the same signature from two interfaces. It just means inheriting implementations from two super types. A class can implement two interfaces and inherit two different default methods, one from each interface. It is still multiple implementation inheritance.

That is what the first sentence in the explanation also says
Multiple inheritance of implementation is the ability to inherit method definitions from multiple classes.
Yes, it would be good to enhance the explanation to option 3 to include static and private methods as well.

thank you for your feedback!