Errata

Learning Java

Errata for Learning Java, Third Edition

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released. If the error was corrected in a later version or reprint the date of the correction will be displayed in the column titled "Date Corrected".

The following errata were submitted by our customers and approved as valid errors by the author or editor.

Color key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted By Date submitted Date corrected
Printed
Page 3
last paragraph

In the first sentence of the last paragraph on the page, the phrase,
"A series of breech of contract and antitrust lawsuits"

NOW READS:
"A series of breach of contract and antitrust lawsuits."

Anonymous    Apr 01, 2006
Printed
Page 11
2nd paragraph

As you'll seein Chapter 4
->
As you'll see in Chapter 4

#########################################

Anonymous    Apr 01, 2007
Printed
Page 16
code sample

A credit card number consists of 16 digits, so the creditCardNumber[16] array has room for only the data and is not a null-terminated string. The %s format requires a null-terminated array.

To fix, change the printf line to
printf("Card number = %.16s\n", cardno);

Note from the Author or Editor:
I see it on page 15 of the printed edition, but yes he is correct. Please adjust to the text he shows above.

Andrew Klossner  Jan 12, 2011  Jul 01, 2011
Printed
Page 31
code in middle of page

frame.add( label );
->
frame.getContentPane().add(label);

#########################################

Anonymous    Apr 01, 2007
Printed
Page 36
code in middle of page

"frame.add" should be changed to "frame.getContentPane().add"

Anonymous  Jun 27, 2011  Jul 01, 2011
Printed
Page 36
2 lines of code 2/3rds down the page

HelloComonent hello = new HelloComponent();
frame.add( hello );
->
frame.add( new HelloComponent() );

#########################################

Anonymous    Apr 01, 2007
Printed
Page 44
3 lines of code 2/3rds down the page

frame.add( new HelloComponent2("Hello, Java!") );

should be:

frame.getContentPane().add( new HelloComponent2("Hello, Java!") );

(The equivalent line is correct on page 42)

Likewise

HelloComponent2 newObject = new HelloComponent2("Hello, Java!");
frame.add( newObject );

should be:

HelloComponent2 newObject = new HelloComponent2("Hello, Java!");
frame.getContentPane().add( newObject );

(probably worth checking for s/frame.add/frame.getContentPane().add/g thoughout)

Note from the Author or Editor:
I searched the current Safari version and found six instances of "frame.add". They should all be "frame.getContentPane().add" (five in chapter 2 and one in chapter 17)

Please let me know if this isn't specific enough.

Anonymous    Jul 01, 2011
Printed
Page 50
first code block

"frame.add" should be "frame.getContentPane().add"

Anonymous  Jun 27, 2011  Jul 01, 2011
Printed
Page 76
the 3 example jar commands

The minus symbol for the command options was previously missing.
This HAS BEEN CORRECTED.

Anonymous    Apr 01, 2006
Printed
Page 87
Table 4-2

Type double (64-bit, IEEE 754) was previously missing.
This entry HAS BEEN ADDED to the table.

Anonymous    Apr 01, 2006
Printed
Page 92
end of 2nd paragraph

"We cover generics in detail Chapter 8."

NOW READS:
"We cover generics in detail in Chapter 8."

Anonymous    Apr 01, 2006
95
Second Code Sample Under "The for loop"

In the code sample:

for ( int i = 0; i < 100; i++ ) {
System. out. println( i )
int j = i;
. . .
}

there should be a semicolon following "println( i )", to read:

for ( int i = 0; i < 100; i++ ) {
System. out. println( i );
int j = i;
. . .
}

Note from the Author or Editor:
He is correct. Please add the semicolon at the end of the line.

Greg Edwards  Nov 16, 2009  Jul 01, 2011
Printed
Page 96
switch statement 1st example

[ case int constantExpression
statement; ]

NOW READS:
[ case int constantExpression :
statement; ]

Anonymous    Apr 01, 2006
Printed
Page 98
Description of the 3rd code sample

prints the numbers 0 through 100
->
prints the numbers 0 through 99

#########################################

Anonymous    Apr 01, 2007
Printed
Page 103
first Java code on the page

The text gives a code snippet which I now embed in a class.

import java.util.*;

public class Page103 {
public static void main(String[] args){
Boolean b;
String str = "foo";
b = (str instanceof String);
b = (str instanceof Object);
b = (str instanceof Date);
}
}

When compiling the following error message is reported.

$ javac Page103.java
Page103.java:9: inconvertible types
found : java.lang.String
required: java.util.Date
b = (str instanceof Date);
^
1 error

The book claims that b is merely set to false.

The reason for the error is stated in the Java language specification in 15.20.2: "If a cast of the RelationalExpression to the ReferenceType would be rejected as a compile-time error, then the instanceof relational expression likewise produces a compile-time error. In such a situation, the result of the instanceof expression could never be true."

Note from the Author or Editor:
He is correct. We should change the line from:

"b = ( str instanceof Date ) ; // false, str is not a Date or subclass"

to:

"// b = ( str instanceof Date ) ; // The compiler is smart enough to catch this!"

Please note the leading "//" comment.

Arthur Nunes-Harwitt  Mar 11, 2010  Jul 01, 2011
Printed
Page 120
in first code snippet array of primes

The number 1 is not a prime. At least according to all the number theory books I
have read.

Note from the Author or Editor:
Ok, change:

int [ ] primes = { 1, 2, 3, 5, 7, 7+4 }; // e. g. , primes[ 2] = 3

to:

int [ ] primes = { 2, 3, 5, 7, 7+4 }; // e. g. , primes[2] = 5

Anonymous    Jul 01, 2011
Printed
Page 121
Code example near middle of page

The authors give a code snippet for creating an array of buttons:

Button [] keyPad = new Button [10];
for (int = 0; i < keyPad.length; i++)
keyPad[i] = new Button(Integer.toString(i));

Soon after, they say "Here we'll use it to print all the values we just assigned:"

for (int i : keyPad)
System.out.println(i);

This won't work because keyPad is an array of objects, not integers. I verified with
the java compiler that this doesn't compile. I get "Type mismatch: cannot convert
from element type button to int"

Note from the Author or Editor:
He is correct.

Please change from:

"for (int i : keyPad)
System.out.println(i);"

to:

"for (Button b : keyPad)
System.out.println(b);"

Please note the variable name i changed to b in two places.

Anonymous    Jul 01, 2011
Printed
Page 122
second paragraph from the bottom

The sentence that reads "The syntax looks just like the initialization of an array in
a variable declaration" isn't entirely true. Their anonymous array parameter looks
like this:

new Animal [] { pokey, boojum, simon }

whereas the initialization of an array in a variable declaration would look like
this:

new Animal [] = { pokey, boojum, simon }

Consider changing "just like" to "similar to".

Note from the Author or Editor:
Please change:

The syntax looks just like the initialization

to:

The syntax looks similar to the initialization

Anonymous    Jul 01, 2011
Printed
Page 126
First code segment following "Classes" heading

The line of code:

float length = 10.0;

is flagged as a type mismatch error by the Java compiler. The 'F' suffix is missing from the declaration of the floating-point constant. The line of code should be:

float length = 10.0F;

Note from the Author or Editor:
thanks!

Scott Wright  Sep 28, 2012 
Printed
Page 127
2nd paragraph

The last sentence in the paragraph says "In either case, if you don't initialize a
variable when you declare it, it's given a default value appropriate for its type
(null, zero, or false)."

"zero" is typeset in constant width font. According to the book preface, in the
"Conventions Used in This Book" section, constant width is for:
- anything that might appear in a Java program
- tags in HTML or XML
- keywords, objects and environment variables

I don't believe the author's intent is to say there is a Java keyword "zero", or a
constant named "zero", or an object with the name "zero", etc., which some variables
are initialized to. Instead, I believe they just mean the numeric value zero: "0".

Consider changing "zero" to "0", or eliminating the constant width font and using
regular font for "zero", so as to avoid implying that the string "zero" has special
significance in Java code.

Note from the Author or Editor:
He is correct. Please use the regular body text font for the zero in:

given a default value appropriate for its type (null, zero, or false).

Anonymous    Jul 01, 2011
Printed
Page 138
Table 5.1

The entries in the left column should not be capitalized. A Void is not a void, and
there's no such thing as an Int in the core language.

Note from the Author or Editor:
Ok, it wasn't really intended to list the Java prim types but since the column is labeled that way let's change it.
Please de-capitalize the items in the left column (e.g. Void, Boolean, Char to void, boolean, char...)

Anonymous    Jul 01, 2011
Printed
Page 151
2nd paragraph

The sentence reads: "Because enumerations are static values, they can be imported
with the new Java static import, saving us some typing:"

Then follows this code snippet:

import mypackage.Weekday.*;

But this isn't really a static import. It should be:

import static mypackage.Weekday.*;

Note from the Author or Editor:
He is correct. Please insert the word "static" as shown.

Anonymous    Jul 01, 2011
Printed
Page 151
5th paragraph

The text explains an enum's compareTo() method as returning an integer greater
than zero when the target enum is greater than the reference enum (in the enum ordering).

Then the authors present the code snippet:

Level level = Level.HIGH;
Level anotherLevel = Level.LOW;
if (level.compareTo( anotherLevel ) > 0 ) // true
doSomething();

The "true" comment would lead one to believe that compareTo() returns an integer
greater than zero in this case. Since anotherLevel is the target enum, and level
is the reference enum, this implies that Level.LOW is greater than Level.HIGH
in the enum order.

It seems odd that LOW would be higher than HIGH, until one realizes that this
condition could be true, given the (counter-intuitive) enum order: { HIGH, ..., LOW }.
But since we aren't told in the example what the actual enum order is, it's not
possible to determine whether the "// true" comment is in fact accurate.

It would be helpful in this case to either include the enum declaration, provide
more detail in the text, or perhaps switch the places of the Level.HIGH and Level.LOW
tokens in the code.

Note from the Author or Editor:
Please swap the LOW and HIGH to:

Level level = Level.LOW;
Level anotherLevel = Level.HIGH;

Anonymous    Jul 01, 2011
Printed
Page 164
class Herbivore in second code segment

The compiler flags the call

super.eat(f);

as an error because it can throw an InedibleException but the enclosing method declaration specifies that just the subtype MeatInedibleException is thrown.

Either the super.eat(f); call needs to be surrounded with a try/catch or the Herbivore.eat() method must be declared to throw InedibleException (rather than MeatInedibleException).

Note from the Author or Editor:
thanks!

Scott Wright  Oct 01, 2012 
Printed
Page 173
2nd paragraph

The text reads:

"The java.io.Serializeable interface is a good example. Classes that implement
Serialize don't have to add any methods or variables."

The problem is the text first calls this interface Serializeable, but then calls
it Serialize. The correct name is Serializeable.

Note from the Author or Editor:
Correct: Please change: "Classes that implement
Serialize don't have to add any methods or variables"

To:

"Classes that implement
Serializeable don't have to add any methods or variables"

Anonymous    Jul 01, 2011
Printed
Page 174
5th paragraph

The paragraph begins:

"The source code for a Java class is organized into compilation units. A simple
compilation unit contains a single class definition and is named for that class."

Isn't this a contradiction?

First it says: "...a Java class", that is ONE Java class, "is organized into
compilation units", that is, MORE THAN ONE compilation unit.

Then it says "A simple compilation unit contains a single class definition", that
is, ONE Java class is organized into ONE compilation unit.

A class must either be organized as one compilation unit, or more than one, but
not both at the same time (unless the one compilation unit is an aggregation of
many sub-compilation units--although the text makes no mention of this).

Note from the Author or Editor:
Please change:

"The source code for a Java class"
to:
"The source code for Java classes"

Anonymous    Jul 01, 2011
Printed
Page 178
5th paragraph

The text reads:

"By treating an object in some respects as a "black box" and ignoring the details
of its implementation, we can write stronger, simpler code..."

"stronger" code is an odd choice of words here. What is "stronger" code? I've heard
it said that encapsulation improves maintainability, modifiability, reusability, and
even testability, but never that it makes code "strong."

Note from the Author or Editor:
I can't read it objectively any more. If whomever is making changes things "stronger" sounds odd please change to "more resilient". But I think it's fine.

Anonymous    Jul 01, 2011
182
Example at end of 1st paragraph

This line:

object[0] = new Date(); // Runtime ArrayStoreException!

Should read:

objects[0] = new Date(); // Runtime ArrayStoreException!

Note from the Author or Editor:
confirmed, please change.
it's on p 182 of the online edition, not sure where in print.

Carl Livermore  May 05, 2009  Jul 01, 2011
Printed
Page 185
code snippet near bottom of page

In the example code, the next() method of the inner Iterator class calls hasMoreElements()
to determine whether there is another Employee in the list to return. However, the
Iterator class does not define a hasMoreElements() method, although it does define a
hasNext() method. In this code, hasNext() would work as the condition, so this is
probably what the authors were intending.

However, the code snippet also contains an ellipses, and hasMoreElements() theoretically
could have been defined there as a method of EmployeeList. However, if hasMoreElements()
were a method of EmployeeList, it wouldn't have access to the iterator's state, and
therefore wouldn't be able to determine whether there was another iteration candidate
available. So this probably isn't what the authors intended.

Note from the Author or Editor:
He is correct. Please change hasMoreElements() to hasNext() here.

Anonymous    Jul 01, 2011
Printed
Page 187
middle of page

Class should not be capitalized in Java source code.

Anonymous   
Printed
Page 188
End of 4th paragraph

Rectangle2d.Float rect = new Rectangle2D.Float();
->
Rectangle2D.Float rect = new Rectangle2D.Float();

#########################################

Anonymous    Apr 01, 2007
Printed
Page 189
In first code snippet

The boolean hasMore() method should actually be boolean hasNext(). Also, once again
I believe the hasMoreElements() method should be hasNext().

Note from the Author or Editor:
Please change from:

Iterator getIterator( )
{
return new Iterator( ) {
int element = 0;
boolean hasMore( ) {
return element < employees. length ;
}
Object next( ) {
if ( hasMoreElements( ) )
return employees[ element++ ] ;
else
throw new NoSuchElementException( );
}
void remove( ) {
throw new UnsupportedOperationException( );
}
};
}

To:

Iterator getIterator( )
{
return new Iterator( ) {
int element = 0;
boolean hasNext( ) {
return element < employees. length ;
}
Object next( ) {
if ( hasNext( ) )
return employees[ element++ ] ;
else
throw new NoSuchElementException( );
}
void remove( ) {
throw new UnsupportedOperationException( );
}
};
}

Two words changed above.

Anonymous    Jul 01, 2011
Printed
Page 199
4th code example

the 4th code example was previously missing a closing curly brace for the try block.
This HAS BEEN CORRECTED.

Anonymous    Apr 01, 2006
Printed
Page 211
3rd Paragraph

"See Appendix A for more information on getting started."

NOW READS:
"See Appendix B for more information on getting started."

Anonymous    Apr 01, 2006
Printed
Page 228
5th (last) paragraph

In the last code example, in the try block, the code should read
"new ExceptionTester<ClassNotFoundException>().test(new ClassNotFoundException());"
rather than
"new E<ClassNotFoundException>().test(new ClassNotFoundException());".

Note from the Author or Editor:
Please change:

new E<ClassNotFoundException>().test(

to:

new ExceptionTester<ClassNotFoundException>().test(

Anonymous    Jul 01, 2011
Printed
Page 249
1st paragraph, last sentence

slight of hand
->
sleight of hand

#########################################

Anonymous    Apr 01, 2007
Printed
Page 281
3rd paragraph, line 3

... Java Community Process JSR-223

NOW READS:
... Java Community Process JSR-166

Anonymous    Apr 01, 2006
Printed
Page 302
second code sample in 10.2.2 Strings From Things

// Equivalent, e.g., "Sun Dec 19 05:45:34 CST 1969"

shows 12/19/69 as a Sunday, but you may recall that it was actually a Friday. Picky? Me?

Note from the Author or Editor:
Please change "Sun" to "Fri"

Anonymous    Jul 01, 2011
Printed
Page 304
Third code sample

if ( log.indexOf("emegency") != -1_ ...

NOW READS:
if ( log.indexOf("emergency") != -1_ ...

Anonymous    Apr 01, 2006
Printed
Page 321
Formatting with the java.text Package

A small correction you may want to bring about to the next edition of this book. Italy's no longer using Lire for its currency but Euro (?) - since 2002 if I remember correctly ?

Note from the Author or Editor:
Not a big deal, but if possible for youto can change the L to the Euro symbol that would be great:

String italy = // L 1.234,56

Sylvester  Jan 06, 2010 
Printed
Page 329
Under "Some (one or more iterations)"

The book states:

For example, the following pattern matches a multiple-digit number with leading zeros:
0*\d+ // match a number (one or more digits) with leading zeros

However I think that it should state:

For example, the following pattern matches a number with one or more digits, plus optional leading zeros.
0*\d+ // match a number (one or more digits) with optional leading zeros


Note from the Author or Editor:
let's use his suggested wording.

Stephen Dewey  Jan 05, 2010  Jul 01, 2011
Printed
Page 330
Under "Range (between x and y iterations, inclusive)"

The book states:

\b\w{5,7}\b // match words with at least 5 and at most 7 letters

However it should read "at least 5 and at most 7 characters" since \w would match digits and underscore characters as well as letters.

Note from the Author or Editor:
ok, let's change "letters" to "characters"

Stephen Dewey  Jan 05, 2010  Jul 01, 2011
Printed
Page 348
Code block above Time Zones section header

calendard.setTime( now )
should read
calendar.setTime( now )

Daniel Pommert  Aug 15, 2012 
352
Table 11-5

On Page 352, Table 11-15, last item:

Currently reads: R 1999, 2004 Four-digit year

Should read: Y 1999, 2004 Four-digit year

Confirmed at http://download.oracle.com/javase/1.5.0/docs/api/java/util/Formatter.html

Note from the Author or Editor:
He is correct. Please change the R to a Y.

Marco Ariano  Mar 29, 2011  Jul 01, 2011
Printed
Page 353
Table 11-6 footnote a

Is:
The second value (60) is a convention used to support leap years.

Should be:
The second value (60) is a convention used to support leap seconds.



For confirmation, go to:
iers.org
Search the web site for leap seconds,
Follow the IERS Glossary: Leap Seconds link
Click on the related link for Leap Seconds
And click on "here" in the "historical list of leap seconds can be found here" which will take you to
http://maia.usno.navy.mil/ser7/tai-utc.dat
The historical list shows many leap seconds (including eight of the last ten) that did not occur during Leap Years.

Note from the Author or Editor:
confirmed. Please change "leap years" to "leap seconds"

William D. Seivert  Jan 08, 2009  Jul 01, 2011
Printed
Page 359
Code snippet in middle of page

In the for loop header "collection" should be "col".

Note from the Author or Editor:
Confirmed, please change:

for( Date date : collection )

to:

for( Date date : col )

Roger House  Nov 08, 2009  Jul 01, 2011
Printed
Page 360
Description of List Interface

public void add( E element )
should be
public boolean add( E element )

Note from the Author or Editor:
confirmed, please change.

Anonymous    Jul 01, 2011
Printed
Page 366
First paragraph

The text says, "In general, a good implementation can operate in linear time for putting and retrieving elements." Linear time for a hash would be horrible performance. It should read, "In general, a good implementation can operate in constant time for putting and retrieving elements." The diagram below it does illustrate an algorithm (hash plus linked list) that is O(N) with a low constant. However, other algorithms are O(logN) and constant. I admit, I don't know what algorithm Java uses.

The C++ STL has a Map that performs in O(logN) time and a less official "hashed associative containers" that work in constant time. I assume Java would use similar technology.

Daniel Pommert  Aug 15, 2012 
Printed
Page 372
code for 'A Thrilling Example'

in the code example, the first line reads

Import java.io.*;

and should read

import java.io.*;

Note from the Author or Editor:
He is correct. "Import" should be all lower case.

Arthur Wood  May 24, 2010  Jul 01, 2011
Printed
Page 374
Properties

Within the for loop written to illustrate the use of propertyNames() method, the condition is badly written:
e.hasMoreElements

should be written as

e.hasMoreElements()

Note from the Author or Editor:
He is correct. Please make it e.hasMoreElements() as shown.

Sylvester  Jan 06, 2010  Jul 01, 2011
Printed
Page 375
System Properties

The static method that returns a Properties from the java.lang.System is not System.getProperty() but System.getProperties().

Note from the Author or Editor:
confirmed. Please change:

through the static System.getProperty() method.

to:

through the static System.getProperties() method.

Sylvester  Jan 06, 2010  Jul 01, 2011
Printed
Page 391
description of PipedWriter

> "Loopback" streams used that can be used [..]

Delete first instance of "used."

Anonymous    Jul 01, 2011
Printed
Page 399
PrintWriter and PrintStream

Within the first code excerpt provided in this section:

System.out.println("The answer is %d", 17 );

Should not it be?

System.out.printf("The answer is %d", 17 );

Note from the Author or Editor:
Confirmed.

Sylvester  Jan 07, 2010  Jul 01, 2011
Printed
Page 403
Second word on the page

"ByteArrrayInputStream" NOW READS "ByteArrayInputStream"

Anonymous    Apr 01, 2006
Printed
Page 405
middle of page

System.getProperty("user.dir")); // e.g., /users/pat"

the second ')' should be omitted, and the example should be like this

"System.getProperty("user.dir"); // e.g., /users/pat"

Anonymous  Nov 05, 2012 
Printed
Page 407
1st full paragraph

In the book it says
"getPath() returns the directory information without the filename"

I did some testing and it seems
getCanonicalPath() - returned the full path, plus filename
getAbsolutePath() - returned the full path, plus filename
getPath() - only returned the filename

Note from the Author or Editor:

Confirmed. Please just delete the portion of the sentence after the semicolon.

"; getPath( ) returns the directory information without the filename."

Anonymous    Jul 01, 2011
Printed
Page 407
Code listing, bottom of the page

Collections.sort(l);

should be

Collections.sort(list);

Note from the Author or Editor:
confirmed, please change as shown

Anonymous    Jul 01, 2011
Printed
Page 407
File Operations

in the 3rd paragraph... It is written 'getCanonical-Paht(); the '-' (dash character) should be removed...

Note from the Author or Editor:
Partially confirmed:

getCanonical-Path( )

to:

getCanonicalPath( )

Sylvester  Jan 08, 2010  Jul 01, 2011
Printed
Page 424
3rd paragraph

...Socket and Datagram channels in Chapter 1.

NOW READS:
...Socket and Datagram channels in Chapter 13.

Anonymous    Apr 01, 2006
Printed
Page 472
5th line of code: WorkRequest , WorkListener listener)

The line
WorkRequest request , WorkListener listener)
should read
final WorkRequest request , final WorkListener listener)

The example code given on this site is correct, but the book leaves out both instances of the word "final".

Note from the Author or Editor:
please change:

public void asyncExecute(
WorkRequest request , WorkListener listener )

to:

public void asyncExecute(
final WorkRequest request, final WorkListener listener )

Anonymous    Jul 01, 2011
Printed
Page 472
MyClientAsync code

When the section entitled "An RMI Example" starts on page 465, the Remote interface is called ServerRemote. It also called ServerRemote in the middle of page 470. However, in the MyClientAsync.java code at the bottom of page 472 it is called RemoteServer. The example code given on this site also uses RemoteServer instead of ServerRemote.

Note from the Author or Editor:

Confirmed. The example online is the reverse, but to be consistent please change the following on p. 472 from:

RemoteServer server = (RemoteServer)

to:

ServerRemote server = (ServerRemote)

Anonymous    Jul 01, 2011
Printed
Page 473
First paragraph down to and including the result listing in the middle of the page

First, since we created a new client class, the line that reads
% rmic MyClient MyServer MyStringIterator
should read
% rmic MyClientAsync MyServer MyStringIterator

The book states that the output you receive when you run the client is:
Sun Mar 5 23:57:19 PDT 2006
4
Foo
Bar
Gee
Async work result = 10000

However, the actual result of running MyClientAsync is:
call done...
Async work result: 10000

The first sentence of the first paragraph on page 473 reads "We use getList() to get the iterator from the server and the loop, printing the strings." This is not the case in either the book or in the example code. StringIterator is never used in the code given for MyClientAsync.java. In fact, the example code given on this site does not even have the getList() method for MyServer.java from the bottom of page 471.

To get results similar to what the book shows, the following code needs to be added before the "server.asyncExecute" line in the code given near the bottom of page 472:

System.out.println(server.getDate());
System.out.println(server.execute(new MyCalculation(2)));
StringIterator iterator = server.getList();
while (iterator.hasNext())
System.out.println(iterator.next());

Note from the Author or Editor:
Thanks!

Anonymous   
Printed
Page 500
Third paragraph, last sentence

"TemperatureLoookup" NOW READS "TemperatureLookup."

Anonymous    Apr 01, 2006
Printed
Page 525
4th paragraph

"we first create the WEB/INF and WEB-INF/classes directories" should read "we first create the WEB-INF and WEB-INF/classes directories"

Note from the Author or Editor:
Thanks!

Daniel Pommert  Oct 11, 2012 
Printed
Page 567
First paragraph of section "Content Panes"

"The content pane is just a Container that covers the visible area of the JFrame or
Jwindow; it is..."

NOW READS:
"The content pane is just a Container that covers the visible area of the JFrame or
JWindow; it is..."

Anonymous    Apr 01, 2006
Printed
Page 597
code example

On page 596 (bottom-half) the text reads as follows: ... The following
example, DateSelector, creates a JSpinner showing the current date and
time. It allows the user to change the date in increments of one week,
...

It did not (in my case), not until I had changed the spinner's editor, as follows:

... (from the main method)
JFrame frame = new JFrame("Date Selector 1.0");

Calendar now = Calendar.getInstance();
Calendar earliest = (Calendar)now.clone();
earliest.add( Calendar.MONTH, -6 );
Calendar latest = (Calendar)now.clone();
latest.add( Calendar.MONTH, 6 );
SpinnerDateModel model = new SpinnerDateModel(
now.getTime(),
earliest.getTime(),
latest.getTime(),
Calendar.WEEK_OF_YEAR);

final JSpinner spinner = new JSpinner(model);

spinner.setEditor(new JSpinner.DefaultEditor(spinner) );
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

i.e. I was forced to "deactivate" the DateEditor.

Note from the Author or Editor:

After this line on 597:

final JSpinner spinner = new JSpinner(model) ;

please add:

// Disable the built-in date editor
spinner.setEditor(new JSpinner.DefaultEditor(spinner) );

Anonymous    Jul 01, 2011
Printed
Page 604
5th paragraph

"you clickthe mouse" should read "you click the mouse"

Daniel Pommert  Oct 11, 2012 
Printed
Page 607
code in middle of page

"frame.add" should be "frame.getContentPane().add"

Anonymous  Jun 27, 2011  Jul 01, 2011
Printed
Page 625
Example on page Formatting fields

SimpleDateFormat ( "mm/dd/yy");
should be ( "MM/dd/yy");

mm is minutes.
MM is Months.

Note from the Author or Editor:
Confirmed please change the "mm/dd/yy" to "MM/dd/yy"

Anonymous    Jul 01, 2011
Printed
Page 668
In constructor for class Border2

In adding the EAST layout "add(p, BorderLayout.E*);" should read " add(p,
BorderLayout.EAST);"

Note from the Author or Editor:
confirmed... should read BorderLayout.EAST

Anonymous    Jul 01, 2011
Printed
Page 697
1st paragraph, 1st sentence

Preceding code snippet on page 696:

g2.translate(50, 0);
g2.rotate(Math.PI / 6);

1st sentence currently reads:
"... (a shift of 50 units right and a rotation of 30 degrees counterclockwise)."

1st sentence should read:
"... (a shift of 50 units right and a rotation of 30 degrees clockwise)."

Note from the Author or Editor:
He is correct. Not sure how that slipped through all this time.

Anonymous  Dec 30, 2009  Jul 01, 2011
Printed
Page 721
End of first paragraph

The book states that "All Swing components implement Printable for you; you
can override it in your own components to customize their printed appearance
or do arbitrary printing."

This is not true. Swing components do not implement Printable and cannot be
directly used as such with the Print Service API.

Note from the Author or Editor:

Please change from:

"All Swing components implement Printable for you; you can override it in your own components to customize their printed appearance or to do arbitrary printing."

to:

"All Swing components implement a print() method, which you can use or override to customize their printed appearance."

I will clarify further in the next edition.

Anonymous    Jul 01, 2011
Printed
Page 824
JAXP parsing code sample, last line

parser.parse( myfile.xml" );
->
parser.parse( "myfile.xml" );

#########################################

Anonymous    Apr 01, 2007
Printed
Page 844
Middle of page

"This ATTLIST says that the Animal element has a class attribute that can have" should read "This ATTLIST says that the Animal element has a animalClass attribute that can have"

Daniel Pommert  Oct 11, 2012 
Printed
Page 871
first sentence of second paragraph

actually a
->
actually is a

#########################################

Anonymous    Apr 01, 2007