| Author |
boolean variable getting method keywords
|
Jingxian Zhou
Greenhorn
Joined: Jun 22, 2010
Posts: 28
|
|
Answer:A,
Explanation :
The correct option is a java bean naming standard
I selected A and B。
Why B is not the correct answer?
Thanks!
PS:
This question quoted from CertPal SCJP1.6 Moke Exam
|
SCJP6(310-065) with 96%, SCWCD (310-083) with 89%, SCBCD 5 (310-091) with 98%
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
|
Please QuoteYourSources. Where does this question come from ? If it's a book, which book. If it's a mock, which mock.
|
[My Blog]
All roads lead to JavaRanch
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
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);
|
 |
Jingxian Zhou
Greenhorn
Joined: Jun 22, 2010
Posts: 28
|
|
Above quote from SCJP Study Guide(Exam 310-065)
So,I think B maybe correct
|
 |
Jingxian Zhou
Greenhorn
Joined: Jun 22, 2010
Posts: 28
|
|
Christophe Verré wrote:Please QuoteYourSources. Where does this question come from ? If it's a book, which book. If it's a mock, which mock.
First,thank you for reply.
Er..I hope you do not reply this every time.
|
 |
Christophe Verré
Sheriff
Joined: Nov 24, 2005
Posts: 14672
|
|
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
|
 |
Jingxian Zhou
Greenhorn
Joined: Jun 22, 2010
Posts: 28
|
|
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。。。
|
 |
 |
|
|
subject: boolean variable getting method keywords
|
|
|