To reference a member in a parent class, you can just call it directly, as in the following example with the output function displaySharkDetails():
For example, the following class overrides one default interface method and redeclares a second interface method as abstract:
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.
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.
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.
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.
Mushfiq Mammadov wrote:5. On page 286, the code output:
"Feeding: " should be "Feeding reptile "
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.
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."
Mushfiq Mammadov wrote:8. Chapter Tests --> Chapter 5 --> the explanation of test 5:
"Option C" should be "Option A"
Mushfiq Mammadov wrote:9. Chapter Tests --> Chapter 5 --> the explanation of test 10:
extend should be extends.
[OCP 21 book] | [OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
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)
[OCP 21 book] | [OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
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.
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)
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![]()
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.
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
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
[OCP 21 book] | [OCP 17 book] | [OCP 11 book] | [OCA 8 book] [OCP 8 book] [Practice tests book] [Blog] [JavaRanch FAQ] [How To Ask Questions] [Book Promos]
Other Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, TOGAF part 1 and part 2
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime. |