Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Agile forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JavaBeans

 
Chandana Garlapati
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which method names follow the JavaBeans standard? (Choose all that apply.)

1) addSize

2) getCust

3) deleteRep

4) isColorado

5) putDimensions

This question is from k&B.
the answer is only 2 and 4 options.
why not 1st option??

can anyone explain??
 
Rajiv Chopra
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chandana Garlapati wrote:Which method names follow the JavaBeans standard? (Choose all that apply.)

1) addSize

2) getCust

3) deleteRep

4) isColorado

5) putDimensions

This question is from k&B.
the answer is only 2 and 4 options.
why not 1st option??

can anyone explain??


Because of JavaBeans Standard.

getStopped() or isStopped() are both valid JavaBeans names for a boolean property.
getSize()is a valid JavaBeans getter name for a property named
"size." Keep in mind that you do not need to have a variable named size

1) is not valid as per JavaBeansStandard.

There is javabean listner naming rule where Listner word is required.

addSizeListener(SizeListener sl) is good as per Javabean Listner naming rule.
 
Chandana Garlapati
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Rajiv.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic