Hello ,
Regarding option 1 , why you considered interfaces to be always abstract ?
Currently with java 8 , they could have a default method which is non-abstract methods so interfaces behalves current with implementation.
Kindly clarify.
About Question enthuware.ocpjp.v8.3.1479 :
Moderators: Site Manager, fjwalraven
-
- Posts: 124
- Joined: Wed Feb 12, 2014 2:44 am
- Contact:
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.3.1479 :
Yes, an interface may have default and static methods. But that doesn't mean it is not abstract. You still can't instantiate an interface precisely because it is abstract.
You can think of it like an abstract class that has some methods implemented. Just because an abstract class has some method implementations doesn't mean it is not abstract anymore.
HTH,
Paul.
You can think of it like an abstract class that has some methods implemented. Just because an abstract class has some method implementations doesn't mean it is not abstract anymore.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 124
- Joined: Wed Feb 12, 2014 2:44 am
- Contact:
Re: About Question enthuware.ocpjp.v8.3.1479 :
Thanks for your answer.
-
- Posts: 1
- Joined: Wed Dec 04, 2013 3:12 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.3.1479 :
According to this Oracle's page https://docs.oracle.com/javase/tutorial ... tance.html :
"Default methods introduce one form of multiple inheritance of implementation. A class can implement more than one interface, which can contain default methods that have the same name. The Java compiler provides some rules to determine which default method a particular class uses."
So, wouldn't it make option D correct?
"Default methods introduce one form of multiple inheritance of implementation. A class can implement more than one interface, which can contain default methods that have the same name. The Java compiler provides some rules to determine which default method a particular class uses."
So, wouldn't it make option D correct?
-
- Site Admin
- Posts: 10079
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.3.1479 :
You are right. It it indeed one form of multiple implementation inheritance. The only thing that is not allowed is multiple inheritance of the same method. Fixed.
thank you for your feedback!
Paul.
thank you for your feedback!
Paul.
If you like our products and services, please help us by posting your review here.
Who is online
Users browsing this forum: No registered users and 3 guests