• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Jeanne Boyarsky
  • Ron McLeod
Sheriffs:
  • Paul Clapham
  • Liutauras Vilda
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

Compiling errata for K&B, SCJP 6

 
author
Posts: 9050
21
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

Okay, I've been hearing rumblings that it's past time to put together an errata list for K&B 6

I'm going to partially pull a 'Tom Sawyer' here - I'll start looking at the notes in my master copy of the book, AND if you guys want to use this thread to add any errata you know of, it'll help speed up the process. (I know, I'm just shameless.)

Thanks for your continued support!

Bert
 
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Table 3-3, page 243, parseXxx method is not marked for Boolean class.

Chapter 3, self test answer 7, line 12 in code, getBidValue should be getValue.

A small change on page 618 will be good, I'm quoting the actual sentence

By saying <? extends Animal>, we're saying, "I can be assigned a collection that is a subtype of List and typed for <Animal> ........."


It would be better if it is

By saying List<? extends Animal>, we're saying, "I can be assigned a collection that is a subtype of List and typed for <Animal> ........."


as the explanation says about List but its not written in the first part.

Another suggestion, chapter 8 self test question 1, option B says

It does not have access to non-static members of the enclosing class


I would say that it should say it does not have DIRECT access to ...... (just a suggestion, I may be pushing it too much)

Another suggestion, chapter 10 page 798, it says

When searching for class files, the java and javac commands don't search the current directory by default


I've seen a few people get confused with this. If we add to it that this happens only if we use the -cp or -classpath flag, that would be great, the context is indeed the -cp/classpath flag so its not wrong, but I've seen a few people get confused with this.

The answer to the 11th question of 10th chapter is wrong (discussed many times like here).

One found in search here

I'll try to come up with some more as I find them...
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
page 409 question 15
a)says "at line 4" and should say "at line 2".
b)in option E I think it should say "line 4" not "line 6"
 
John Summers
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
maybe this thread should be pinned near the top while the list is being compiled?
 
Ranch Hand
Posts: 252
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Page 317 (ch 4): Question 8, line 10 should read

if (b1 || (b2 = true)) s += "x";
instead of:
if (b1 || (b2 == true)) s += "x";

That is what is there in the repetition of question 8 in the Answers section and also in the explanation of the answers.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This one is from the MasterExam CD, question 52 of the first open book test questions.

The class contains these variables:


The hashCode() function is defined as:



The exam claims that the following code (option D) is ok for the equals method:


As far as I can see, if you have, for example, one SortOf object with code="foo", bal=1,rate=2 and another with code="bar",bal=2, rate=1 then their hashcodes are different (3 versus 6) but the equals method would report them as equal (since 3*1*2==3*2*1).

That would be bad.
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Page 281, Chapter 3 Test Question 7 Answer

The code from the answer does not match the code from the original question on page 272. The code on 281 will not compile because of line 12 -- there is no getBidValue() method defined.

Picky, I know, but confusing if you don't go back and look at the original question.

(THANKS FOR THE BOOK!)
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Page 458 Missing String type.

On the line #14: name = c.readLine("%s", "input?: ");

should be: String name = c.readLine("%s", "input?: ");
 
Ranch Hand
Posts: 33
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
On page 217 (chapter 3), part of the code is as follow:
class Foo{
static int size=7;
.... rest of the code.
The description on the page calls the variable size as an instance variable instead of static.
 
Martin Leon
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 10 Self Test, Question 11, page 817, 818.

Foo.java declares that Foo is in the package myApp.

GetJar refers to "Foo.d" but does not either import myApp.* or refer to Foo.d by its fully qualified name. There is no way to get this code to compile.
 
Martin Leon
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 10 Self Test, Question 12, page 818, 819.

This is just a typo I'm sure. Part of the question refers to the contents of "GetJar.java" but the rest of the question refers to the class GoDeep.
 
Martin Leon
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 10 Self Test, Question 2, page 811, 812

My book has a "." after the "A" as part of the command line that is invoked. None of the answers have a ".", so none of them are correct.

Try it:



java _ - A .
 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 2: Object Orientation

Figure 2-8 "The effects of static on methods and variables":



Method void go() has a semicolon instead of curly braces. By the way, this code was demonstrating how a static method cannot access a non-static method.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 5 - page 343

Java loops come in three flavors: while, do, and for (and as of Java 6, the for
loop has two variations).

I think this should read (and as of Java 5,...

Regards
Joss Armstrong
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Same issue on page 345 and 350

Joss Armstrong wrote:Chapter 5 - page 343

Java loops come in three flavors: while, do, and for (and as of Java 6, the for
loop has two variations).

I think this should read (and as of Java 5,...

Regards
Joss Armstrong

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there going to be an official confirmation of the errata reported here? A normal errata sheet would be easier to use.
 
Greenhorn
Posts: 3
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello, Bert.

First of all I must say that your SCJP 6 Study Guide book is great! You managed to explain complex topics with a rare combination of precision and humor. Thanks as lot!
Now the tough part: In chapter 5, section "Legal Expressions for if Statements" (page 333) the examples reported have been very confusing to me. I started to ask myself: "which is the operator precedence among the &&, ||, &, |, !=, and ^ operators?". In your book I could not find any answer. Yet, the topic is important if the student wants to fully understand (and remember) your examples and not fail this topic in the exam. I tried to infer myself the operator precedence based on your examples, and it was hard to figure it out. I could only browse other (online) material to find an answer. Only watching at the operator precedence table in the online Sun Java Tutorials trail (see Equality, Relational, and Conditional Operators section at http://java.sun.com/docs/books/tutorial/java/nutsandbolts/operators.html) I could clearly learn the precedence sequence and fully understand your examples.

It would be probably great if you insert (even a partial section of) the table in your next version of the SCJP guide.

Greeetings,

Aldo
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I have identified the following printing error in chapter 7, table 7-2

In that table, the first two entry is for "HashTable", i belive one of them should be "HashMap".
 
Ranch Hand
Posts: 814
Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Java Baba
See JavaRanch Naming Policy
 
Pravin Sarkar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
@Ninad
i have read the naming policy and my name follows all the obligations,
if still it needs to be changed,
then please moderators, do let me know.
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
removed
 
Ankit Garg
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Java Baba wrote:i have read the naming policy and my name follows all the obligations,


No it doesn't. Please change it...
 
Pravin Sarkar
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ok guys,, this is Java Baba.. and the name is changed,,,
 
Justin Fleming
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, not sure if this qualifies. Table 7-5 states that the * allows you to specify if the endpoints in a subset are exclusive, while they actually let you specify whether the endpoints are inclusive. I mean, in a way it lets you specify if they are exclusive, because thats another way to say the same thing by passing the opposite boolean value in.

Stating this the way it is in the book (that your specifying whether or not the endpoints are exclusive) I would expect that if a boolean value true is passed the endpoint should be exclusive, but instead they are inclusive. This was identified in test problem 11 at the end of chapter where I got the incorrect answer because of the confusion since I study from these tables. But now that I made this post I'm sure I will remember it correctly.
 
Jerome Jacobsen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
p 571 2 instances of "Collections.sort(dvdlist)" should instead read "Collections.sort(dvdList)". Because the 'L' in 'dvdList' is uppercase on p570.
 
Jerome Jacobsen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
p 590 in the NOTE the term "exclusive" should be "inclusive" instead to be consistent with the text above the paragraph and with the name of the boolean parameters in the relevant methods
 
Jerome Jacobsen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
p 593, Table 7-6. some of the methods show the "public" access modifier and some don't. i imagine you want to remove the "public" as it is implied and uses up space in your table.
 
Jerome Jacobsen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
p. 606, 3rd paragraph, first sentence:

"Keep in mind, then, that the problem of putting the wrong thing into a typed (generic) collection does not show up at the time you actually do the add() to the collection."

The sentence is not accurate for sorted collections. When doing an add() to a sorted collection, such as a TreeSet, the ClassCastException will occur during the add() operation.

The statement would be true if changed to read as below since Lists are not sorted collections.

"Keep in mind, then, that the problem of putting the wrong thing into a typed (generic) List does not show up at the time you actually do the add() to the List."
 
Jerome Jacobsen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
p. 651, question 5:

I would argue that F is a more appropriate answer than E.

Your AccountManager class encapsulates its accountTotals map. Write access to it is limited to:
public void setBalance(String accountName, int amount)

No other code in AccountManager modifies the map values.

So there is no way to get a null value into accountTotals map.

Had the method signature been this instead, I would agree with your answer E:
public void setBalance(String accountName, Integer amount)
 
Jerome Jacobsen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
chapter 9, p.756, 3rd sentence: I believe you meant IllegalMonitorStateException instead of IllegalThreadState exception.
 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm taking the sample tests on the CD that came with the book and there are a couple of questions that might have incorrect answers. Is this an appropriate forum for queries of this type?

Thanks
 
Ankit Garg
Sheriff
Posts: 9708
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The forum is appropriate but the topic might not be as this topic is for the book not the mock exam. Create a new topic for the errors in the mock exams...
 
Bert Bates
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Rich and Ankit,

Actually, I'd prefer that errata on the CD are also listed here, it would help me out!

Also, THANKS to everyone for posting these! I tend to look into these in baches, so pretty soon I'll review all of these and give you all some feedback!

Bert
 
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also in page 558 fig 7.2 The interface and class hierarchy for collections,

The arrow symbol seems to be wrong.

HashSet implements Set but the arrow shows as 'extends'. Similarly for TreeSet and TreeMap (implements NavigableSet and NavigableMap respectively).

Forgive me if this has been reported elsewhere.

Thanks
Praveen

 
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In Certification Objective: Implementing an Interface (Exam Objective 1.2) (sorry no page number because I have only an online version of K&B, SCJP 6 that has no page numbering) I read the third point below and I am confused by the underlined part.

Is it possible that there is a typo there? Is it saying a concrete class must declare no subclasses of those declared by the interface method? What does that even mean???

"... a nonabstract implementation class must do the following:
- Provide concrete (nonabstract) implementations for all methods from the declared interface.
- Follow all the rules for legal overrides.
- Declare no checked exceptions on implementation methods other than those declared by the interface method, or subclasses of those declared by the interface method".
 
Jerome Jacobsen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
p 448 comments in code at top of page next to "size = fr.read(in)" should have "bytes" replaced with "characters"

so it should read: "// how many characters read" rather than "// how many bytes read"
 
Jerome Jacobsen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 6, Self Test Question #11, p. 537

Your explanation states the B would be correct if a char[] was used instead of a String. For B to be correct it would have to look like this:

username: fred
hello fred
password:

It is missing the "hello fred" that was output on line 8 of the code.
 
Jerome Jacobsen
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 9, Self Test Question 9:

The answer A is also correct: "It prints X and exits".

Sure, it also prints the Exception to standard error. But A is correct the way it is worded, in addition to G.

For example, on Windows try this (assuming you named your class Ch09Q09):
java Ch09Q09 2> output.err

The console output will be:
X

The output.err file will contain:
Exception in thread "main" java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at Ch09Q09.main(Ch09Q09.java:6)
 
Larry Chung
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chapter 6 Self Test, Question 7, page (unknown because I am using an online version of K&B).

INCORRECT:
"...and the output is ''false true''; which set(s) of code fragments must be inserted? (Choose all that apply.) "

CORRECT:
"...and the output is ''false false''; which set(s) of code fragments must be inserted? (Choose all that apply.) "
 
Hey, check out my mega multi devastator cannon. It's wicked. It makes this tiny ad look weak:
Smokeless wood heat with a rocket mass heater
https://woodheat.net
reply
    Bookmark Topic Watch Topic
  • New Topic