• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Clarification

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add and remove are for event listeners.
 
I love a good mentalist. And so does this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic