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

All the posts and topics that contain only an error report will be moved here after the error is corrected. This is to ensure that when users view a question in ETS Viewer, the "Discuss" button will not indicate the presence of a discussion that adds no value to the question.

Moderators: Site Manager, fjwalraven

Post Reply
Denyo1986
Posts: 38
Joined: Thu Jan 07, 2021 2:47 am
Contact:

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

Post 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

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Right. Added.
thank you for your feedback!

Denyo1986
Posts: 38
Joined: Thu Jan 07, 2021 2:47 am
Contact:

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

Post by Denyo1986 »

Thank you for helping me to pass the exam :)

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Congratulations on passing!!

Deleted User 6318

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

Post by Deleted User 6318 »

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.

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

What happened when you tried it out ?

Double-O-Jim
Posts: 1
Joined: Tue Dec 26, 2023 8:40 pm
Contact:

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

Post 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.

admin
Site Admin
Posts: 10384
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post 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!

Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests