About Question enthuware.ocpjp.v8.2.1828 :

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
pdolezal
Posts: 3
Joined: Fri Jan 29, 2016 11:56 am
Contact:

About Question enthuware.ocpjp.v8.2.1828 :

Post by pdolezal »

A note in the solution to the question tells for an option:
super.methodName(...) is a valid way to invoke a super class's method from anywhere within a subclass's method. But it works only for classes. You cannot invoke the interface's default method using this technique. In fact, if a class (or an interface) overrides a default method of an interface, there is no way to invoke that default method from that class (or interface).
The colored part is incorrect. There is a way to invoke the default method (which may be useful, e.g., when inheriting two different interfaces with the same method and default implementations, or simply when the default is good enough, just needs some decoration):

This code snippet demonstrates it:

Code: Select all

interface Foo {
    default void foo() {
        
    }
}

interface Bar extends Foo {
    default void foo() {
        Foo.super.foo(); // Use the parent interface as the qualifier for 'super'
    }
}

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

Re: About Question enthuware.ocpjp.v8.2.1828 :

Post by admin »

You are right. This has now been fixed.

thank you for your feedback!
Paul.

Post Reply

Who is online

Users browsing this forum: No registered users and 8 guests