If the question is about JavaBeans (it looks like it), the convention for boolean getters is to name them "isXXXX", not "getXXXX".
From the JavaBeans spec:
8.3.2 Boolean properties
In addition, for boolean properties, we allow a getter method to match the pattern:
public boolean is<PropertyName>();
This "is<PropertyName>" method may be provided instead of a "get<PropertyName>" method, or it may be provided in addition to a "get<PropertyName>" method. In either case, if the "is<PropertyName>" method is present for a boolean property then we will
use the "is<PropertyName>" method to read the property value. An example boolean property might be:
public boolean isMarsupial();
public void setMarsupial(boolean m);
One day I'll learn to read what I post The specification says "This "is<PropertyName>" method may be provided instead of a "get<PropertyName>" method", so answer B looks right too.
Christophe Verré wrote:One day I'll learn to read what I post The specification says "This "is<PropertyName>" method may be provided instead of a "get<PropertyName>" method", so answer B looks right too.
Er..I hope you do not reply this every time.
As long as you quote your sources
Thanks a lot!
This question quoted from CertPal SCJP1.6 Moke Exam
I explained quote。。。
SCJP6(310-065) with 96%, SCWCD (310-083) with 89%, SCBCD 5 (310-091) with 98%
No, tomorrow we rule the world! With this tiny ad:
a bit of art, as a gift, the permaculture playing cards