Jerome Jacobsen

+ Follow
since Jan 26, 2010
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jerome Jacobsen

Hmmm. Checkout this weirdness. I thought the first compile command would work. And it seems to have worked for others in this thread. But I have to add a classpath separator even though I'm only supplying one path to the classpath. Strange.


>javac -version
javac 1.6.0_12

Volume in drive C has no label.
Volume Serial Number is BCC4-9595

Directory of C:\Development\SCJP\Chapter10\test

03/11/2010 08:39 AM <DIR> .
03/11/2010 08:39 AM <DIR> ..
03/11/2010 08:27 AM 123
03/11/2010 08:27 AM <DIR> myApp
03/11/2010 08:26 AM 938 MyApp.jar
2 File(s) 1,061 bytes
3 Dir(s) 27,877,011,456 bytes free

>javac -classpath MyJar.jar package myApp does not exist
1 error

>javac -classpath MyJar.jar;


Interestingly this also works:
>javac -classpath .

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:

The output.err file will contain:
Exception in thread "main" java.lang.IllegalMonitorStateException
at java.lang.Object.wait(Native Method)
at Ch09Q09.main(
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

It is missing the "hello fred" that was output on line 8 of the code.
p 448 comments in code at top of page next to "size =" should have "bytes" replaced with "characters"

so it should read: "// how many characters read" rather than "// how many bytes read"
chapter 9, p.756, 3rd sentence: I believe you meant IllegalMonitorStateException instead of IllegalThreadState exception.
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)
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."
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.
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
p 571 2 instances of "Collections.sort(dvdlist)" should instead read "Collections.sort(dvdList)". Because the 'L' in 'dvdList' is uppercase on p570.
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,...

Joss Armstrong

What do employers typically want to see as proof of certification? Do they want to see the grade? Does the email sent from Certification Manager show the grade?

Of course the answer to these questions will influence how much time I spend preparing the the test.