About Question enthuware.ocpjp.v8.2.1827 :

Help and support on OCA OCP Java Programmer Certification Questions
1Z0-808, 1Z0-809, 1Z0-815, 1Z0-816, 1Z0-817

Moderator: admin

Post Reply
dfedorino
Posts: 1
Joined: Wed Jan 20, 2021 8:00 pm
Contact:

About Question enthuware.ocpjp.v8.2.1827 :

Post by dfedorino »

Hello!
At first, thank you, authors, for providing such an effective and affordable way to prepare for Java certification, your work is significant. I'll paste the question code and one of the explanations to illustrate what I want to clarify:

Code: Select all

interface Book{
	public default String getId() {
		return "ISBN123456";
	}
}
interface Encyclopedia extends Book{
	//INSERT CODE HERE
}
One of the options is to insert the following lines:

Code: Select all

static String getId() {
	return "AIN8888";
}
The lines above will cause a compile-time error because a default method cannot be overridden by a static method. However, the explanation literally says "You cannot override a static method with a non-static method.." I believe it supposed to say - "You cannot override a default method with a static method." instead, as there is a default method in the super interface.

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

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

Post by admin »

Hi,
Which question bank are you using? Because I see that it was updated in the 1z0-809 as well as 1z0-819 question banks. Please download the latest version of the question bank.
If you like our products and services, please help us by posting your review here.

Javatje
Posts: 9
Joined: Wed Jun 30, 2021 6:53 am
Contact:

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

Post by Javatje »

Answer 3 overrides a public method with a method with weaker access privileges (i.e. package private). Why does this not lead to a compilation error?

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

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

Post by admin »

Every method of an interface is implicitly public unless it is explicitly declared private. So, the method in option 3 is actually implicitly public (same as the one in the base interface).
If you like our products and services, please help us by posting your review here.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 26 guests