This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Clarification  RSS feed

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Ranchers,

Page 78 (K & B Java 5):

5. Which method names follow the JavaBeans standard? (Choose all that apply.)
A. addSize
B. getCust
C. deleteRep
D. isColorado
E. putDimensions
Answer:
� 3 B and D use the valid prefixes 'get' and 'is'.
�˚ A, C, and E are incorrect because 'add', 'delete' and 'put' are not standard JavaBeans
name prefixes. (Objective 1.4)

Page 68 (K & B Java 5):
JavaBeans methods must be named using camelCase, and depending on the
method's purpose, must start with set, get, is, add, or remove.

According to page 68 choice A should also be correct. Can anybody clarify?

Thanks
 
Ranch Hand
Posts: 809
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On page 68, its mentioned that JavaBean method must be camelCase and it must start with set, get, is, add, remove depending upon the method purpose.

method purpose is important.

Look at the following code... Here I hav add and remove method to add and remove bidder from list.

add and remove are business methods here.

There is no corresponding private field defined in javabean. Whereas setters/getters are javabean methods.
U can have isXXX() or getXXX() for boolean field. For others getXXX().




The answer mentioned in the book is correct. Its only B & D. Name which conforms to standard is only setXXX, getXXX and isXXX.


Naseem
[ May 17, 2006: Message edited by: Naseem Khan ]
 
Ranch Hand
Posts: 245
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
add and remove are for event listeners.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!