Hello again, and sorry bothering you one more time.
As I said in another topic, I just finished the first mock exam of Sybex online tool (from the OCA Study Guide), and in question 37, I believe there is a mistake in the answer explanation.
The correct answer is letter C, because a primitive variable can't call methods, so the code won't compile. But then, the explanation says "Although Shark does compile, it does not have a main() method and will...". But the class doesn't compile because of the numFins.toString(), and then the explanation says that it does compile.
I believe this isn't right. I've already searched in the official errata, and didn't find anything about it.
I see what you mean, but I don't think explanation is wrong.
Authors I think imply that class would compile having method Main() instead main() assuming that other lines are valid.
That sentence in particular explaining Main() and main() differences. Don't look at a whole context of this code snippet, look to its distinctive parts.
Liutauras Vilda wrote:I see what you mean, but I don't think explanation is wrong.
The explanation is wrong as it is crystal-clear that class Shark does not compile (totherwise answer C would have been the wrong answer). The correct statement for the explanation would have been: "If Shark would have compiled,..."
We know it doesn't compile, what I was saying were only my thoughts what authors might tried to imply. So, I don't think authors were trying to explain it wrongly, they just made some implications in my understanding. But if user got some uncertainty in that - clarification would do no harm.