Page 1 of 1
About Question enthuware.ocpjp.v7.2.1115 :
Posted: Tue Oct 01, 2013 12:11 pm
by moormanm
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
Re: About Question enthuware.ocpjp.v7.2.1115 :
Posted: Tue Oct 01, 2013 12:40 pm
by admin
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.
Re: About Question enthuware.ocpjp.v7.2.1115 :
Posted: Thu Oct 03, 2013 9:15 am
by moormanm
Thanks Paul!
Re: About Question enthuware.ocpjp.v7.2.1115 :
Posted: Tue Apr 07, 2015 7:54 am
by winddd
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.
In that case, there are no correct answers.
Re: About Question enthuware.ocpjp.v7.2.1115 :
Posted: Tue Apr 07, 2015 8:59 am
by admin
winddd wrote: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.
In that case, there are no correct answers.
Why do you think so? Synchronized keyword can certainly be applied to an instance method of a class.
thank you,
Paul.
Re: About Question enthuware.ocpjp.v7.2.1115 :
Posted: Tue Apr 07, 2015 10:37 am
by winddd
and static methods
Re: About Question enthuware.ocpjp.v7.2.1115 :
Posted: Tue Apr 07, 2015 11:10 am
by admin
It doesn't say that synchronized keyword can ONLY be applied to instance methods.
Re: About Question enthuware.ocpjp.v7.2.1115 :
Posted: Sun Jul 19, 2015 6:35 pm
by gk_javauser
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?
Re: About Question enthuware.ocpjp.v7.2.1115 :
Posted: Sun Jul 19, 2015 8:07 pm
by admin
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).
Re: About Question enthuware.ocpjp.v7.2.1115 :
Posted: Fri Jul 24, 2015 5:18 pm
by gk_javauser
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).
Thanks for the additional info and confirmation.