About Question enthuware.ocpjp.v8.-2-.1827 :

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
johnlong
Posts: 197
Joined: Mon Jun 20, 2016 5:06 pm
Contact:

About Question enthuware.ocpjp.v8.-2-.1827 :

Post by johnlong »

Hi

Explanation says:
You cannot override a static method with a non-static method and vice-versa.

Code: Select all

interface i1{
	static void m1(){}	
}

interface i2 extends i1{
	default void m1(){}
}
But it's possible to override static method with default one.

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

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

Post by admin »

What you have shown is not overriding. The concept of overriding applies only to instance method.

zukras
Posts: 5
Joined: Fri Jun 02, 2017 4:57 pm
Contact:

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

Post by zukras »

What "vice-versa" means in this context then? I guess I would suggest to choose different wording. Very confusing.

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

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

Post by admin »

It means you cannot override a non-static method with a static method either. The second line of the explanation already makes it very clear, " You can, however, redeclare a static method of a super interface as a default method in the sub interface."

crazymind
Posts: 85
Joined: Mon Dec 24, 2018 6:24 pm
Contact:

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

Post by crazymind »

You can, however, redeclare a static method of a super interface as a default method in the sub interface.
How about redeclare a default method of a super interface as a static method in the sub interface? Option 1 seems correct ...

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

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

Post by admin »

What happened when you tried it out?

crazymind
Posts: 85
Joined: Mon Dec 24, 2018 6:24 pm
Contact:

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

Post by crazymind »

admin wrote:
Wed Mar 06, 2019 7:49 pm
What happened when you tried it out?
static String getId(){ return "AIN8888"; } }
^
overriding method is static


Why? I am trying to redefine default method to static method not overriding it.

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

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

Post by admin »

So you can see that it is not allowed. Rule of the language.

bvrulez
Posts: 33
Joined: Sat Feb 15, 2020 12:44 am
Contact:

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

Post by bvrulez »

The explanation to the first (not correct) option is:

"You cannot override a static method with a non-static method. You can, however, redeclare a static method of a super interface as a default method in the sub-interface."

The option was to use "static String getId() {return "AIN8888"; }" to override "public default String...". So, the explanation refers to a different problem and is not fitting the option. The Explanation should say: "You cannot redeclare a default method as a static method in a sub-interface."

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

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

Post by admin »

You are right. Fixed.
thank you for your feedback!

d0wnvk@gmail.com
Posts: 7
Joined: Wed Jun 06, 2018 6:46 am
Contact:

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

Post by d0wnvk@gmail.com »

admin wrote:
Thu Feb 20, 2020 4:49 am
You are right. Fixed.
Not fixed.
The latest version of question bank is 1/81.

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

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

Post by admin »

It is fixed. The explanation says, "You cannot override a non-static method with a static method and vice versa.". The last part was not there earlier.

Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests