About Question enthuware.ocajp.i.v7.2.1205 :

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

Moderator: admin

Post Reply
Svetopolk
Posts: 22
Joined: Sun Nov 18, 2012 1:51 am
Location: Moscow
Contact:

About Question enthuware.ocajp.i.v7.2.1205 :

Post by Svetopolk »

1st wrong answer: Interfaces permit multiple implementation inheritance.
Explanation: Interfaces do not contain any implementations and only permit multiple interface inheritance.

My native language is not English, probably it is the reason why I can't understand the explanation.
The explanations consists of two parts:
1) Interfaces do not contain any implementations
2) Interfaces permit multiple interface inheritance.

Part 2 is exactly the ansewer. So why is it wrong?

Svetopolk
Posts: 22
Joined: Sun Nov 18, 2012 1:51 am
Location: Moscow
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by Svetopolk »

Also I can't understand why 2nd answer is correct:
"Unlike a class, an interface can extend from multiple interfaces."
but a class can also implement multiple interfaces

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

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by admin »

1. There is a difference between the option statement and the explanation. Option says "implementation inheritance" and while the explanation says, "interface inheritance". That is why the option is wrong. Interfaces do not contain/inherit implementations.

2. 2nd option is correct because an interface can extend from multiple interface while a class cannot extend from interface(s), it implements them.

HTH,
Paul
If you like our products and services, please help us by posting your review here.

Svetopolk
Posts: 22
Joined: Sun Nov 18, 2012 1:51 am
Location: Moscow
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by Svetopolk »

Paul, thank you for your patience very much, it is clear now ...

madhurisatish
Posts: 15
Joined: Thu Sep 10, 2015 3:50 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by madhurisatish »

Hi, I have a doubt in the explanation.

"Variables in interfaces are always static and method prototypes in interfaces can never be static."

I agree variables are always static.

But method prototypes in interfaces can never be static is confusing.
Since in Oracle docs, The interface body can contain abstract methods, default methods, and static methods.

So how can we say method can never be static?

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

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by admin »

In Java 8, interfaces can have static and default methods. Not in Java 7.
If you like our products and services, please help us by posting your review here.

madhurisatish
Posts: 15
Joined: Thu Sep 10, 2015 3:50 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by madhurisatish »

So, the exam is based on Java 7, should be keep only abstract methods in the exam if asked about methods of interfaces are implicitly?

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

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by admin »

Yes, exams 803 and 804 are based on java 7.
If you like our products and services, please help us by posting your review here.

madhurisatish
Posts: 15
Joined: Thu Sep 10, 2015 3:50 pm
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by madhurisatish »

Hi My question is about the answer which we should keep for the interface methods? Please respond

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

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by admin »

I am not sure I understand your confusion. If you are taking exams 803 or 804, you need to remember that an interface can only contain abstract methods and static fields. It cannot contain default methods and static methods. In other words, all methods of an interface must be abstract.

-Paul.
If you like our products and services, please help us by posting your review here.

jxCode
Posts: 1
Joined: Thu Jul 14, 2016 4:30 am
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by jxCode »

Members of an interface may be static.

"may be" confuse me .

Members of an interface are static!

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

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by admin »

Methods of an interface are not static.(In Java 8, they may be static as well).
If you like our products and services, please help us by posting your review here.

st.lisker
Posts: 22
Joined: Sat Jun 30, 2018 6:11 am
Contact:

Re: About Question enthuware.ocajp.i.v7.2.1205 :

Post by st.lisker »

"may be " means that also "may be not" :evil:

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 48 guests