About Question enthuware.ocpjp.v7.2.1115 :
Moderator: admin
-
- Posts: 3
- Joined: Tue Oct 01, 2013 12:08 pm
- Contact:
About Question enthuware.ocpjp.v7.2.1115 :
Do instance methods include static methods? The Synchronized keyword can refer to static methods as well as instance methods.
Q:
The synchronized keyword can be applied
A:
an instance method of a class
Q:
The synchronized keyword can be applied
A:
an instance method of a class
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1115 :
No, instance methods do not include static methods and vice versa. Both are different things.
synchronized keyword can be applied to instance as well as static methods.
A valid option does not have to cover all possibilities.
HTH,
Paul.
synchronized keyword can be applied to instance as well as static methods.
A valid option does not have to cover all possibilities.
HTH,
Paul.
-
- Posts: 3
- Joined: Tue Oct 01, 2013 12:08 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1115 :
Thanks Paul!
-
- Posts: 18
- Joined: Wed Feb 11, 2015 10:48 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1115 :
In that case, there are no correct answers.No, instance methods do not include static methods and vice versa. Both are different things.
synchronized keyword can be applied to instance as well as static methods.
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1115 :
Why do you think so? Synchronized keyword can certainly be applied to an instance method of a class.winddd wrote:In that case, there are no correct answers.No, instance methods do not include static methods and vice versa. Both are different things.
synchronized keyword can be applied to instance as well as static methods.
thank you,
Paul.
-
- Posts: 18
- Joined: Wed Feb 11, 2015 10:48 am
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1115 :
and static methods
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1115 :
It doesn't say that synchronized keyword can ONLY be applied to instance methods.
-
- Posts: 9
- Joined: Sun Jul 19, 2015 6:31 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1115 :
Hello,
I wanted to confirm something related to this answer choice's explanation:
a method in an interface
All methods in an interface are implicitly abstract.
Even though it is not stated here, all methods in an interface are implicitly public also right? Is there any time this is not the case?
I wanted to confirm something related to this answer choice's explanation:
a method in an interface
All methods in an interface are implicitly abstract.
Even though it is not stated here, all methods in an interface are implicitly public also right? Is there any time this is not the case?
-
- Site Admin
- Posts: 10384
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1115 :
Yes, all methods in an interface are always implicitly public as well.
Just FYI, in Java 8, interfaces may have non-abstract methods as well. These are called as "default" methods. Java 8 also allows static methods (which are also not abstract).
Just FYI, in Java 8, interfaces may have non-abstract methods as well. These are called as "default" methods. Java 8 also allows static methods (which are also not abstract).
-
- Posts: 9
- Joined: Sun Jul 19, 2015 6:31 pm
- Contact:
Re: About Question enthuware.ocpjp.v7.2.1115 :
Thanks for the additional info and confirmation.admin wrote:Yes, all methods in an interface are always implicitly public as well.
Just FYI, in Java 8, interfaces may have non-abstract methods as well. These are called as "default" methods. Java 8 also allows static methods (which are also not abstract).
Who is online
Users browsing this forum: No registered users and 12 guests