Win a copy of 97 Things Every Java Programmer Should Know this week in the Java in General 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger

OCA 1Z0-808 Chapter 4 Mock Explanation #9 page 344 (Sybex) AND online Chapter 4 Mock Explanation #9

Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Explanation to question 9 for Mock in the book mentions A, C, E are the correct answers. Shouldn't this be A, E?
  • Regarding answer A: The theory in table 4.5 on page 206 mentions: "Getter methods begin with is or get if the property is a boolean." So isn't this answer correct then?
  • Regarding answer C: The theory in table 4.5 on page 206 mentions: "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." Since the getter method is called getNumWings and the variable is called numberWings, this doesn't follow the JavaBeans convention, right, so answer C should be incorrect?

  • The online material mentions C, E are correct. Again, shouldn't this be A, E?
    Posts: 3959
    • Likes 1
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    hi Manfred,

    there have been many discussions about answer C on this forum. I myself had the exact same question. But how it works is:

    suppose you have a private field of type 'X', called 'b', and that there is a method: public X getA() {return b;};

    Then you have a property called 'A', and its value is b. I have read and re-read this part of the book, and although with hindsight the explanation is correct, many (including me) would have thought that b was the property. and the method should have been called 'getB'.

    It takes a while before you believe it and accept it, but there you go.
    Thank you my well lotioned goddess! Here, have my favorite tiny ad!
    Devious Experiments for a Truly Passive Greenhouse!
      Bookmark Topic Watch Topic
    • New Topic