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

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

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: 10036
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!
If you like our products and services, please help us by posting your review here.

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: 10036
Joined: Fri Sep 10, 2010 9:26 pm
Contact:

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

Post by admin »

Congratulations on passing!!
If you like our products and services, please help us by posting your review here.

noeloo
Posts: 61
Joined: Sat Feb 15, 2020 8:56 am
Contact:

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

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

admin
Site Admin
Posts: 10036
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 ?
If you like our products and services, please help us by posting your review here.

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: 10036
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!
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], marpiva and 30 guests