This week's book giveaway is in the Spring forum.
We're giving away four copies of Spring in Action (5th edition) and have Craig Walls on-line!
See this thread for details.
Win a copy of Spring in Action (5th edition) this week in the Spring 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
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Knute Snortum
  • Junilu Lacar
  • paul wheaton
Saloon Keepers:
  • Ganesh Patekar
  • Frits Walraven
  • Tim Moores
  • Ron McLeod
  • Carey Brown
Bartenders:
  • Stephan van Hulst
  • salvin francis
  • Tim Holloway

Sybex OCA chap.4 question 9 errata?  RSS feed

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
In my Sybex book, for the answer of question 9, chapter 4 It is written that the responses are "A, C, E. [...] Options C and E follow normal getter and setter conventions. Option A is correct but the book doesn't explain this [...]". On the web site there is an errata indicated for this page: "9. The correct answer is A, C and E. But if you got C and E, give yourself credit for getting it correct. The chapter text is incorrect on this, but the exam doesn’t cover this edge case. (In fact, it doesn’t cover JavaBeans at all. That is in the book, in case it is added back in)."

There is no errata indicated on page 220 for this question. For recall this question is "which are methods using JavaBeans conventions [...]".
Answer A is: That is compliant with table 4.5 (start with get, valid for a boolean, and the property is canSwim)
Answer E is: That is compliant with table 4.5.

But I do not agree with the fact that response C is correct. This answer is It follows the rule "getter methods begin with get". But it does not follow the rule "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".

So, for me, the following changes should be done on response C to follow the JavaBeans property:
1- rename the method in getNumberWings,
2- Or rename the property in numWings.
 
Ranch Hand
Posts: 116
11
Eclipse IDE Hibernate Java Netbeans IDE Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I asked this same question once. Here you can find a good answer for it.
 
João Victor Gomes
Ranch Hand
Posts: 116
11
Eclipse IDE Hibernate Java Netbeans IDE Postgres Database Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, of course, there are other topics about this subject. They are all referenced in the topic that I shared with you.
 
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's probably in the top-5 (might even be in top-3) of most asked questions in this forum
 
Alain Kaufmann
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
sorry but I  still not agree with your answer(from equivalent topics). Page 205, it is written "JavaBeans calls an instance variable a property". Moreover in table 4.5 the first rule is "properties are private". And in front of this sentence, it is written "private int numEggs;" clearly saying that the property name is numEggs. Thus, setters and getters following the JavaBeans conventions, and particularly the last one listed in table 4.5 can only be getNumEggs, and setNumEggs, eventually isNumEggs (for a boolean). getNumberEggs follows the setter/getter conventions but not the JavaBeans conventions.  

I will add that, if you consider answer C as correct just because the method starts by get, there is no reason, to consider line 18 on page 20 as wrong just because the "propert name" does not start by an uppercase. The function also starts by set!

In every case a comprehensive errata must be added. I can be:
page 206: "The name following set/get can be not related to the name of the instance variable",
or "Answer C is wrong".

But as long as we will not have a valid errata on this problem, it will stay in the top 5.

 
Roel De Nijs
Sheriff
Posts: 11338
177
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Alain Kaufmann wrote:sorry but I  still not agree with your answer(from equivalent topics).


The only thing I know is that the explanation I have provided in the referenced topics is spot-on with regard to the JavaBeans specifications. But it might contradict with other statements in the study guide (I haven't read it, so I don't know).
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!