• 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
  • Liutauras Vilda
  • Tim Cooke
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Devaka Cooray
  • Ron McLeod
  • paul wheaton
Saloon Keepers:
  • Tim Moores
  • Piet Souris
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Frits Walraven
  • Scott Selikoff

Kathy Sierra book - doubt - javaBeans name convention

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

Kathy's book page 68 says:


JavaBeans methods must be named using camelCase, and depending on the
method's purpose, must start with set, get, is, add, or remove.



and on the self test it says:


A, C, and E are incorrect because 'add', 'delete' and 'put' are not standard JavaBeans
name prefixes. (Objective 1.4)



could anyone please explain what I lost because, first it says that "add" should be used then says it should not.

Thanks in advance!
 
Ranch Hand
Posts: 383
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Read again properly. It says 'add' can be used with Listener methods. And in example it uses 'add' with no Listener method.

I think I make you clear.
 
Marcelo Ribeiro
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the explanation, but it is not so clear yet, at these examples:


public void removeMyListener(MyListener m) //correct

public void addXListener(MyListener m) // listener type mismatch



at books's question the option where we have add is:

addSize



if it was

addListenerSize



would it be correctly?

Thank you!
 
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic