In chapter 4 in table 4.5 about naming conventions I read that "Getter methods begin with IS or GET if eht property is BOOLEAN." In the summary of chapter 4 is stated that "Javabeans use methods beginning with IS and GET for BOOLEAN and NON_BOOLEAN property type, respectively." These 2 lines contradicts.
Besides that, question 9 in the book and question 9 at Wileys testbanks about the naming conventions are exactly the same. But the answer in the book differ from the answer at Wileys testbanks. The book uses the theory of the table, the online question the theory of the summary. S
So I have the following questions:
1. Is it possible that the theory in table 4.5 and the summary are explained the same way.
2. Is it possible that the book and the online quizz give the same answer and last but not least
3. Can someone explain to me which is right. Table 4.5 or the summary?
Please give us full details of the book, so we know which one it is, and also details of questions if appropriate. Remember that many readers haven't got that book. The first quote does appear to be ambiguous, but have you quoted it exactly?
The title of the book is:
OCA Oracle Certified Associate Java SE 8 Programmer I Study Guide
By Jeanne Boyarsky and Scott Selikoff
The ISBN: 978-1-118-95740-0
Pagenr of table 4.5: 206
Pagenr of summary: 215, but the specific sentence is on page 216
Pagenr of question 9 in the book: 220
posted 1 year ago
Thank you for the details
Methods returning a boolean are usually called isXXX(), hasXXX(), canXXX(), or similar, not getXXX(), so the first quote seems to be the wrong way round, assuming you have copied it exactly. It is “get”, not “GET”, by the way.
The second sentence with “respectively” has them the right way round. Note it is only compulsory to start boolean get methods isXXX() if you are following the Bean pattern.
Please look here; I cannot find such an error being reported previously.
I typed "GET" and "IS" in uppercase to emphasize them. I know in the real world they should be typed in lowercase. But anyway, I now know what to use with booleans and non-booleans. For me that was the main thing because, to my humble opinion, it is very important to use standards so everyone is able to read my code.
posted 1 year ago
Jan Dales wrote:Thank you for the explanation. . . . Jan
That's a pleasure
When all four tires fall off your canoe, how many tiny ads does it take to build a doghouse?
Devious Experiments for a Truly Passive Greenhouse!