Page 1 of 1
About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Sun Nov 18, 2012 12:14 pm
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?
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Sun Nov 18, 2012 12:20 pm
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
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Sun Nov 18, 2012 5:50 pm
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
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Mon Nov 19, 2012 1:05 am
by Svetopolk
Paul, thank you for your patience very much, it is clear now ...
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Fri Sep 25, 2015 12:27 am
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?
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Fri Sep 25, 2015 1:34 am
by admin
In Java 8, interfaces can have static and default methods. Not in Java 7.
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Fri Sep 25, 2015 2:18 pm
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?
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Fri Sep 25, 2015 8:51 pm
by admin
Yes, exams 803 and 804 are based on java 7.
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Sat Sep 26, 2015 2:57 pm
by madhurisatish
Hi My question is about the answer which we should keep for the interface methods? Please respond
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Sat Sep 26, 2015 10:16 pm
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.
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Fri Jul 29, 2016 10:54 am
by jxCode
Members of an interface may be static.
"may be" confuse me .
Members of an interface are static!
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Fri Jul 29, 2016 11:28 am
by admin
Methods of an interface are not static.(In Java 8, they may be static as well).
Re: About Question enthuware.ocajp.i.v7.2.1205 :
Posted: Sat Jul 14, 2018 12:40 pm
by st.lisker
"may be " means that also "may be not"
