Page 1 of 1
About Question com.enthuware.ets.scjp.v6.2.652 :
Posted: Sun Jan 30, 2011 9:28 pm
by ETS User
Which of these are not legal declarations within a class?
Explanation:
'static' and 'final' are valid modifiers for both 'variable' and 'method' declarations within a class.
'transient' and 'volatile' modifiers are only valid for 'variables'.
'abstract' and 'native' are only valid for 'methods'.
Note: a class can have only have 'final', 'abstract' and 'public' as modifiers.
By 'variable' and 'variables' are you referring to instance variables, as opposed to local variables?
BTW: The CAPTCHA's that this web page provides are very difficult to decipher. Is there any way to turn down messiness in the CAPTCHA? I spent the last 15 minutes going through many, many CAPTCHA images that were way too difficult, I believe, for the average person to decipher, before I finally deciphered one correctly.
Thank you
Re: About Question com.enthuware.ets.scjp.v6.2.652 :
Posted: Mon Jan 31, 2011 7:13 am
by admin
Yes, the explanation has been updated to:
'static' and 'final' are valid modifiers for both member field and method declarations within a class.
'transient' and 'volatile' modifiers are only valid for member field declarations.
'abstract' and 'native' are only valid for member methods.
Note: a class declaration can have only have 'final', 'abstract' and 'public' as modifiers.
Within a method, a local variable may be declared as final.
Regarding CAPTCHA, I have tried to decrease the hardness. Please let me know if it is better now.
HTH,
Paul.
Re: About Question com.enthuware.ets.scjp.v6.2.652 :
Posted: Mon Jan 31, 2011 8:36 pm
by Guest
'static' and 'final' are valid modifiers for both member field and method declarations within a class.
OK. Thank you. So by "member field" are you referring to an instance variable that is defined within a class, but outside a method (non local)?
Re: About Question com.enthuware.ets.scjp.v6.2.652 :
Posted: Mon Jan 31, 2011 8:49 pm
by admin
Yes.
Re: About Question com.enthuware.ets.scjp.v6.2.652 :
Posted: Sun Mar 20, 2011 6:36 pm
by Guest
A class can also have strictfp as the modifier?