About Question enthuware.ocpjp.v8.2.1828 :
Posted: Wed Jun 30, 2021 7:38 am
One of the explanations provided when reviewing this question is not clear. I am not saying the explanation is wrong. I am saying it is not clear.
Unclear sentence #1:
"super.methodName(...) is a valid way to invoke a SUPER CLASS's method from anywhere within a subclass's method."
I guess they mean to say that super.methodName(...) is NOT a valid way to invoke an INTERFACE's method from anywhere within a subclass's method.
Unclear sentence #2:
"A class (or an interface) can invoke a default method of an interface that is explicitly mentioned in the class's implements clause (or the interface's extends clause) by using the same syntax i.e. <InterfaceName>.super.<methodName>."
I guess they mean to say that <InterfaceName>.super.<methodName> is a valid way to invoke an interface's method. They confuse this message by unnecessarily repeating trivial information about inheritance syntax of classes and interfaces.
Furthermore, they fail to explain why this <InterfaceName>.super.<methodName> must be used instead of super.<methodName>. This is because multiple inheritance is not possible with classes, but it is with interfaces. Therefore, super.<methodName> is an ambiguous statement when referring to a parent interface -> Which one of the multiple possibilities are you referrring to. The solution -> <InterfaceName>.super.<methodName>
Unclear sentence #3:
"However, THIS technique cannot be used to invoke a default method provided by an interface that is not directly implemented (or extended) by the caller."
The use of a double negative (i.e. "cannot be" and "is not") is confusing.
Also, the pronoun "this" is confusing. Do they mean super.methodName(...) - of which they somewhat explained that it could indeed not be used? Or do they mean <InterfaceName>.super.<methodName> - of which they claimed that it could be used .... but now apparently cannot be used after all!?!?
I guess they mean to say that the technique <InterfaceName>.super.<methodName> can only be used if <InterfaceName> is directly implemented.
Unclear sentence #1:
"super.methodName(...) is a valid way to invoke a SUPER CLASS's method from anywhere within a subclass's method."
I guess they mean to say that super.methodName(...) is NOT a valid way to invoke an INTERFACE's method from anywhere within a subclass's method.
Unclear sentence #2:
"A class (or an interface) can invoke a default method of an interface that is explicitly mentioned in the class's implements clause (or the interface's extends clause) by using the same syntax i.e. <InterfaceName>.super.<methodName>."
I guess they mean to say that <InterfaceName>.super.<methodName> is a valid way to invoke an interface's method. They confuse this message by unnecessarily repeating trivial information about inheritance syntax of classes and interfaces.
Furthermore, they fail to explain why this <InterfaceName>.super.<methodName> must be used instead of super.<methodName>. This is because multiple inheritance is not possible with classes, but it is with interfaces. Therefore, super.<methodName> is an ambiguous statement when referring to a parent interface -> Which one of the multiple possibilities are you referrring to. The solution -> <InterfaceName>.super.<methodName>
Unclear sentence #3:
"However, THIS technique cannot be used to invoke a default method provided by an interface that is not directly implemented (or extended) by the caller."
The use of a double negative (i.e. "cannot be" and "is not") is confusing.
Also, the pronoun "this" is confusing. Do they mean super.methodName(...) - of which they somewhat explained that it could indeed not be used? Or do they mean <InterfaceName>.super.<methodName> - of which they claimed that it could be used .... but now apparently cannot be used after all!?!?
I guess they mean to say that the technique <InterfaceName>.super.<methodName> can only be used if <InterfaceName> is directly implemented.