Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Chapter 4 Review Question #9

 
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.
 
Marshal
Posts: 3149
466
Android Eclipse IDE TypeScript Redhat MicroProfile Quarkus Java Linux
  • 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: 69856
278
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch CIC
 
pie. tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic