Page 1 of 1
					
				About Question enthuware.ocpjp.v8.-2-.1827 :
				Posted: Sat Jul 09, 2016 9:32 pm
				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.
 
			 
			
					
				Re: About Question enthuware.ocpjp.v8.2.1827 :
				Posted: Sat Jul 09, 2016 10:01 pm
				by admin
				What you have shown is not overriding. The concept of overriding applies only to instance method.
			 
			
					
				Re: About Question enthuware.ocpjp.v8.2.1827 :
				Posted: Wed Jul 25, 2018 8:17 am
				by zukras
				What "vice-versa" means in this context then? I guess I would suggest to choose different wording. Very confusing.
			 
			
					
				Re: About Question enthuware.ocpjp.v8.2.1827 :
				Posted: Wed Jul 25, 2018 8:43 am
				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."
			 
			
					
				Re: About Question enthuware.ocpjp.v8.2.1827 :
				Posted: Wed Mar 06, 2019 6:20 pm
				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 ...
 
			 
			
					
				Re: About Question enthuware.ocpjp.v8.2.1827 :
				Posted: Wed Mar 06, 2019 7:49 pm
				by admin
				What happened when you tried it out?
			 
			
					
				Re: About Question enthuware.ocpjp.v8.2.1827 :
				Posted: Fri Mar 08, 2019 3:46 pm
				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.
 
			 
			
					
				Re: About Question enthuware.ocpjp.v8.2.1827 :
				Posted: Fri Mar 08, 2019 9:57 pm
				by admin
				So you can see that it is not allowed. Rule of the language.
			 
			
					
				Re: About Question enthuware.ocpjp.v8.2.1827 :
				Posted: Thu Feb 20, 2020 3:34 am
				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."
			 
			
					
				Re: About Question enthuware.ocpjp.v8.2.1827 :
				Posted: Thu Feb 20, 2020 4:49 am
				by admin
				You are right. Fixed.
thank you for your feedback!
			 
			
					
				Re: About Question enthuware.ocpjp.v8.2.1827 :
				Posted: Mon Oct 05, 2020 10:42 am
				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.
 
			 
			
					
				Re: About Question enthuware.ocpjp.v8.2.1827 :
				Posted: Tue Oct 06, 2020 12:26 am
				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.