This week's book giveaway is in the Cloud/Virtualization forum.
We're giving away four copies of Grokking Bitcoin and have Kalle Rosenbaum on-line!
See this thread for details.
Win a copy of Grokking Bitcoin this week in the Cloud/Virtualization 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
  • Liutauras Vilda
  • Bear Bibeault
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
  • Knute Snortum
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Frits Walraven
Bartenders:
  • Carey Brown
  • salvin francis
  • Claude Moore

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: 2504
321
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: 64109
215
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch CIC
 
Does this tiny ad smell okay to you?
Create Edit Print & Convert PDF Using Free API with Java
https://coderanch.com/wiki/703735/Create-Convert-PDF-Free-Spire
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!