• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Some minor typos in chapter 5 (Java OCA 8 Programmer I Study Guide, Sybex)

 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1. On page 244, "Calling Inherited Class Members" section, the second paragraph:
To reference a member in a parent class, you can just call it directly, as in the following example with the output function displaySharkDetails():

Maybe function should be method.


2. On page 254, "Overriding vs. Hiding Methods" section, the second paragraph, the second sentence:
Maybe ParentClassName.method() should be new ParentClassName().method() . Because we call static methods with this syntax - ParentClassName.method(). But in this case we refer overriden method.


3. On page 272, second code example, Bear class:
line 1 does not compile too. It may be added comment to this line.


4. On page 276, the last paragraph:
For example, the following class overrides one default interface method and redeclares a second interface method as abstract:

class should be interface, because there are no class in the following example, both of them are interface.


5. On page 286, the code output:
"Feeding: " should be "Feeding reptile "


6. On page 347, the first sentence of mock explanation #8:
We know that interface variables are public, static and final. In the explanation public and static are noted but final isn't.


7. On page 349, the second sentence of mock explanation #18:
"..since int is not a subclass of String." should be "..since String is not a subclass of int."


Online materials

8. Chapter Tests --> Chapter 5 --> the explanation of test 5:
"Option C" should be "Option A"



9. Chapter Tests --> Chapter 5 --> the explanation of test 10:
extend should be extends.






 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mushfiq Mammadov wrote:1. On page 244, "Calling Inherited Class Members" section, the second paragraph:
To reference a member in a parent class, you can just call it directly, as in the following example with the output function displaySharkDetails():

Maybe function should be method.

Yep, that's probably a better choice of words.

Mushfiq Mammadov wrote:2. On page 254, "Overriding vs. Hiding Methods" section, the second paragraph, the second sentence:
Maybe ParentClassName.method() should be new ParentClassName().method() . Because we call static methods with this syntax - ParentClassName.method(). But in this case we refer overriden method.

Definitely agree! ParentClassName.method() is the syntax to invoke a static method. But from the context of that paragraph new ParentClassName().method() is also not correct (because you are creating a new instance of the parent class, instead of using the method of the current object). You must use super.method() to explicitly invoke (and execute) a parent method when it's overridden. As illustrated in this code snippetOutput:
go:65
go2:42


Mushfiq Mammadov wrote:3. On page 272, second code example, Bear class:
...
line 1 does not compile too. It may be added comment to this line.

True! (By the way, that's a difference with Java 7, because if you compile the Bear class you only have two compiler errors)

Mushfiq Mammadov wrote:4. On page 276, the last paragraph:
For example, the following class overrides one default interface method and redeclares a second interface method as abstract:

class should be interface, because there are no class in the following example, both of them are interface.

You are spot-on!

Mushfiq Mammadov wrote:5. On page 286, the code output:
"Feeding: " should be "Feeding reptile "

Correct! Or the feed() method of the ZooWorker class can be changed as well to match with the output

Mushfiq Mammadov wrote:6. On page 347, the first sentence of mock explanation #8:
We know that interface variables are public, static and final. In the explanation public and static are noted but final isn't.

True! final is missing and should be added to the list.

Mushfiq Mammadov wrote:7. On page 349, the second sentence of mock explanation #18:
"..since int is not a subclass of String." should be "..since String is not a subclass of int."

Correct again! The method defined in the interface has int as return type.

Mushfiq Mammadov wrote:8. Chapter Tests --> Chapter 5 --> the explanation of test 5:
"Option C" should be "Option A"

Indeed!

Mushfiq Mammadov wrote:9. Chapter Tests --> Chapter 5 --> the explanation of test 10:
extend should be extends.

If C is intended to be a correct answer, the answer option must be changed as well (and not only the text in the explanation). Because currently option C is an incorrect answer (as the keyword is extends and not extend)

Hope it helps!
Kind regards,
Roel
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) While method would be better, function and method tend to get used interchangeably so don't worry about it.

2,3, 4) Agreed. Logged as errata.

5) Roel's fix is what we intended.

6, 7) Agreed. Logged as errata

8, 9) Agreed. Interestingly both are right in the printed book. Which means that error doesn't belong to Scott or myself.
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:If C is intended to be a correct answer, the answer option must be changed as well (and not only the text in the explanation). Because currently option C is an incorrect answer (as the keyword is extends and not extend)

Agreed. And that's more significant than the reported problem!
 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote: Definitely agree! ParentClassName.method() is the syntax to invoke a static method. But from the context of that paragraph new ParentClassName().method() is also not correct (because you are creating a new instance of the parent class, instead of using the method of the current object). You must use super.method() to explicitly invoke (and execute) a parent method when it's overridden.

You are right, Roel, I forgot super keyword

Roel De Nijs wrote: If C is intended to be a correct answer, the answer option must be changed as well (and not only the text in the explanation). Because currently option C is an incorrect answer (as the keyword is extends and not extend)

I didn't write it, because I reported it in this thread
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mushfiq Mammadov wrote:
Roel De Nijs wrote: If C is intended to be a correct answer, the answer option must be changed as well (and not only the text in the explanation). Because currently option C is an incorrect answer (as the keyword is extends and not extend)

I didn't write it, because I reported it in this thread

But that's the book and this is online It's strange to see that the explanation in the printed book is correct (using extends), but in the explanation online it's not. Or maybe the online publisher noticed the "C is correct" part and noticed extend in option C, and helped the authors by fixing that "typo" and replaced extends with extend
 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In this thread I noted that the same typos which were reported for paper book existed for online materials. Therefore I didn't note that online typos which were already reported for paper book.
Sometimes I notice that there is a bit difference between online materials and paper book. I think such maybe the paper book were read again once and were edited before printing
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mushfiq Mammadov wrote:In this thread I noted that the same typos which were reported for paper book existed for online materials. Therefore I didn't note that online typos which were already reported for paper book.

Yeah, now I remember it again You should have added that thread to your previous post as well. You should never rely on my drastically fading memory
 
Mushfiq Mammadov
Ranch Hand
Posts: 187
25
Java jQuery Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Roel De Nijs wrote:Yeah, now I remember it again You should have added that thread to your previous post as well. You should never rely on my drastically fading memory

Don't worry for your memory because you were on holiday when I wrote that post Maybe you read all new posts very quickly after holiday so you don't remember it instantly
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mushfiq Mammadov wrote:Sometimes I notice that there is a bit difference between online materials and paper book. I think such maybe the paper book were read again once and were edited before printing

Maybe, but no. I actually checked our original manuscripts and they didn't contain that error. Which means it was only introduced in the online version. I'm guessing someone was trying to be helpful.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic