Campbell Ritchie wrote:There isn't a “following class”. There are two classes. Assuming the line about dates (No 17) shouldn't be there, and assuming there is no Bear class, I found four compile‑time errors
The code in the book:
The code in the online test:
The explanation for the the answer is the same in both versions:
Line 10 does not compile because the override reduces the visibility of an inherited method, with the package-private modifier being more restrictive than the protected modifier. Line 11 does also not compile, since the left-hand side of a compound assignment operator must be used with a variable, not a method. Finally, Line 12 does not compile because super.grunt() is inherited as an abstract method in the PolarBear class, meaning the parent class has no implementation. For these three reasons, Option D is the correct answer.
So the differences are:
Line 2: bear instead of BearLine 3: protected in sing instead of protected int sing;Line 13.5: There is only one return statement (there are two in the book).
Charles O'Leary wrote:The online experience does not appear to be under the authors' control. I try to stick strictly to each book and its respective errata for the best experience.
I thought you were also working on the online version. I did just notice that there are two return statements in the book version, which is not mentioned in the answer.
The version I have is
this one