• 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:
  • Liutauras Vilda
  • Campbell Ritchie
  • Tim Cooke
  • Bear Bibeault
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Knute Snortum
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Ganesh Patekar
  • Stephan van Hulst
  • Pete Letkeman
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Ron McLeod
  • Vijitha Kumara

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!