About Question enthuware.ocpjp.v8.2.1115 :
Moderator: admin
-
- Posts: 4
- Joined: Fri Sep 30, 2016 4:44 am
- Contact:
About Question enthuware.ocpjp.v8.2.1115 :
Synchronised keyword can also assigned to static methods so incomplete facts!, and what about static methods inside interface?
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1115 :
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.
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.
-
- Posts: 6
- Joined: Wed Dec 14, 2016 11:29 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1115 :
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!
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!
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1115 :
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.
HTH,
Paul.
If you like our products and services, please help us by posting your review here.
-
- Posts: 9
- Joined: Thu Feb 02, 2023 12:18 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1115 :
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"
"any non-abstract instance method of a class"
-
- Site Admin
- Posts: 10046
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1115 :
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.
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.
-
- Posts: 9
- Joined: Thu Feb 02, 2023 12:18 pm
- Contact:
Re: About Question enthuware.ocpjp.v8.2.1115 :
Yes, true, i understand, thank you.
Who is online
Users browsing this forum: Bing [Bot] and 69 guests