About Question enthuware.ocpjp.v8.2.1115 :

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

Moderator: admin

Post Reply
vlive07@gmail.com
Posts: 4
Joined: Fri Sep 30, 2016 4:44 am
Contact:

About Question enthuware.ocpjp.v8.2.1115 :

Post by vlive07@gmail.com »

Synchronised keyword can also assigned to static methods so incomplete facts!, and what about static methods inside interface?

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

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

Post by admin »

The explanation does provide complete facts. It clearly says, "The synchronized keyword can be applied only to non-abstract methods that are defined in a class or a block of code appearing in a method or static or instance initialization blocks. It cannot be applied to methods in an interface."

1. static methods of a class are indeed included in "Non-abstract methods of a class".
2. The statement, "It cannot be applied to methods in an interface", includes static or default methods.

HTH,
Paul.
If you like our products and services, please help us by posting your review here.

ibugaienko
Posts: 6
Joined: Wed Dec 14, 2016 11:29 pm
Contact:

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

Post by ibugaienko »

Hi Paul,

Second option is ambiguous.
Any method of a [abstract, concrete] class. From the given wording it does not conclude that the class is abstract and if it is not - it could not have any abstract methods.

At the same time the correct answer appears to be missing information about static methods (granted static methods can not be abstract) by explicitly saying "instance".

Either the wording should be more accurate or I would not call this a "Very Easy" question.

BR!

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

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

Post by admin »

The given wording does not conclude that the class is a concrete class either. It just says "class", which includes abstract class also. So you need to consider both the possibilities.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.

robhun79
Posts: 9
Joined: Thu Feb 02, 2023 12:18 pm
Contact:

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

Post by robhun79 »

I agree with Ibugaeinko and maybe i am wrong but if the last option explicitly says "instance method", then i cant see how this could also mean static method. But maybe i am wrong.
"any non-abstract instance method of a class"

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

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

Post by admin »

The option doesn't include static class.But the problem statement or the option do not claim to be exhaustive an list of things on which synchronized can be applied.

The option claims that synchronized can be applied to a non-abstract instance method, and this is true because it can indeed be applied to a non-abstract instance method. It doesn't say synchronized can be applied only to a non-abstract instance method.
If you like our products and services, please help us by posting your review here.

robhun79
Posts: 9
Joined: Thu Feb 02, 2023 12:18 pm
Contact:

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

Post by robhun79 »

Yes, true, i understand, thank you.

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 69 guests