• 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
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

Chapter 4 Review Question #9  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not really sure if this is an error, but find it really confusing.

Which are methods using JavaBeans naming conventions for accessors and mutators? (Choose all that apply)  


And the answers per the appendix is A, C, E. But I think C would be incorrect, since one of the Javabean naming rules said "The method name must have a prefix of set/get/is, followed by the first letter of the property in uppercase, followed by the rest of the property name."
Property name is numberWings, so method name getNumWings should be wrong? Please clarify if I'm wrong.
 
Saloon Keeper
Posts: 2406
296
Android Angular Framework Eclipse IDE Java Linux MySQL Database Redhat TypeScript
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Cl Castillo wrote:... the Javabean naming rules said "The method name must have a prefix of set/get/is, followed by the first letter of the property in uppercase, followed by the rest of the property name."

Property name is numberWings, so method name getNumWings should be wrong? Please clarify if I'm wrong.



According to The Java™ Tutorials: Glossary of Terms:
    property: Characteristics of an object that users can set, such as the color of a window.
    field: A data member of a class. Unless specified otherwise, a field is not static.

In this case:numWings is a property, and numberWings is a field.
 
Marshal
Posts: 63461
207
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch CIC
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!