I got the following two comments on the errata page. I'm replying here so I can be more verbose and in case there is any more discussion about it.
B is correct. A private instance variable automatically gets initialized to the default value for the data type. In the case of a String, this is null. This is true of all instance variables. Their access modifier is not relevant to how they are initialized. And since the main method is in the same class, it is allowed to access private variables.
Same deal. The hasHorns() method is a private method in the Deer class. This means that only code in the Deer class can access it. Line 7 is in the main method of the Deer class and can therefore access this method. The subclass Reindeer also has a hasHorns() method. This method is not inherited since the subclass can't see the private method in the superclass.
So in both these cases, the book is correct and you can trust it . We are logging everything incorrect (no matter how minor) on our errata page. So far there are two mock questions with incorrect answers and four typos that are wrong. Everything else is minor/obvious. And if you aren't sure of something you read, feel free to post a question in this here forum to inquire. Either someone will clarify your understanding or we will confirm it is an error.
Page xxxvi Introduction
Question 12, Answer B is incorrect. It is a private variable.
B is correct. A private instance variable automatically gets initialized to the default value for the data type. In the case of a String, this is null. This is true of all instance variables. Their access modifier is not relevant to how they are initialized. And since the main method is in the same class, it is allowed to access private variables.
Oracle Certified Associate Jave SE 8 Programmer 1:
Page xxxiv Introduction, Answer to Question 8 is incorrect. HasHorns method is Private and cannot be accessed by the Parent class. Can I trust the rest of this book?
Same deal. The hasHorns() method is a private method in the Deer class. This means that only code in the Deer class can access it. Line 7 is in the main method of the Deer class and can therefore access this method. The subclass Reindeer also has a hasHorns() method. This method is not inherited since the subclass can't see the private method in the superclass.
So in both these cases, the book is correct and you can trust it . We are logging everything incorrect (no matter how minor) on our errata page. So far there are two mock questions with incorrect answers and four typos that are wrong. Everything else is minor/obvious. And if you aren't sure of something you read, feel free to post a question in this here forum to inquire. Either someone will clarify your understanding or we will confirm it is an error.