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 snippet
Output:
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