Java Pocket Guide

Errata for Java Pocket Guide

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 xi
Bootm of the page

"...Chapters 9 though 18..." should read "...Chapters 9 through 18", as 'through' was misspelled.

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Sep 02, 2008  Oct 01, 2008
Printed
Page 5
code under the heading "Package Names"

Page 5, The text: "package com.oreilly.fish_finder" should end with a semi-colon, "package com.oreilly.fish_finder;"

scottd_oreilly  Jun 21, 2011  Jun 24, 2011
Printed
Page 5,24,45
Various

The Chicago Manual of Style (The University of Chicago Press, 2003) states the following instruction for grammar usage: "i.e.; e.g. The first is the abbreviation for id est ("that is"); the second is the abbreviation for exempli gratia ("for example")..." To adhere to this instruction the following changes in the Java Pocket Guide should be made: Page 5: "(i.e., com, net...)" should read "(e.g., com, net...)". Page 45: "...all instances of a class (i.e., a counter)." should read "...all instances of a class (e.g., a counter).". Page 24: "...using primitives, e.g., iterating through primitives is a container, should be done..." should read "...using primitives (e.g., iterating through primitives is a container) should be done...".

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Sep 03, 2008  Oct 01, 2008
Printed
Page 10
Under 'Separators'

Nine ASCII character separators are listed, but surely ':' (full colon) should be listed as the 10th. Colons are used as separators both in the enhanced for loop and also in the assert statement.

Note from the Author or Editor:
The Seperators text on page ten should read: Twelve ASCII characters delimit program parts and are used as seperators. ( ), { }, [ ] and < > are used in pairs. ( ) { } [ ] < > : ; , .

Michael callaghan  Jun 24, 2009  Jun 24, 2011
Printed
Page 20
Floating-Point Entities section

The Floating-Point Entities section should explain how to test whether a value is NaN: Double.isNaN(), Float.isNaN().

Note from the Author or Editor:
I'm adding this coverage: The Double and Float wrapper classes have methods to determine if a number is infinite or NaN . Double.isInfinite(Double.POSITIVE_INFINITY); // true Double.isInfinite(Double.NEGATIVE_INFINITY); // true Double.isInfinite(1); // false Double.isNaN(Double.NaN); // true Double.isNaN(Double.NaN); // false Float.isInfinite(Float.POSITIVE_INFINITY); // true Float.isInfinite(Float.NEGATIVE_INFINITY); // true Float.isInfinite(1); // false Float.isNaN(Float.NaN); // true Float.isNaN(1); // false Thank you for the errata submission.

Steve Chapel  Aug 30, 2011 
Printed
Page 28
various

For consistency with the rest of the book, there should be a space after the comment marks. "//This" should read "// This". "//if" should read "// if".

Anonymous  Jun 21, 2011  Jun 24, 2011
Printed
Page 30
code example

I would like to know that if the code example for modChairCount method is the right one. Shouldn't it just be the following? void modChairCount(int i) { i = 10; } with int i = 10 within the method block will cause an duplicated local variable error.

Note from the Author or Editor:
The proposed change is correct.

Anonymous  Mar 03, 2010  Jun 24, 2011
Printed
Page 30
code example

text: "t.setLength (36);" should be "t.setLength(36)" with no space in between.

Anonymous  Mar 03, 2010  Jun 24, 2011
Printed
Page 33
Within the TIP

The TIP states: String classes are immutable. While this is accurate, the following would be more helpful to the reader: Objects of the String class are immutable. Objects of the StringBuffer and StringBuilder classes are mutable.

Note from the Author or Editor:
This errata was opened by myself.

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Aug 28, 2008  Oct 01, 2008
Printed
Page 35
Close to top

On page 34, "In shallow cloning:" is represented as regulary text with a colon. This is correct. On page 35, "In deep cloning" is represented as bold-faced text without a colon. This is wrong. "In deep cloning:" should be represented as regular text with a colon (similar to that of "In shallow cloning:" on page 34).

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Sep 02, 2008  Oct 01, 2008
Printed
Page 36
Object-Oriented Programming chapter

The chapter on object-oriented programming does not cover instance or static initializers.

Note from the Author or Editor:
Static Initializers are covered in Java 7 Pocket Guide; 2nd Edition

Steve Chapel  Jul 13, 2011 
Printed
Page 40
various

Minor refinement can be done by removing the words, "Note that". That is, "Note that subclasses do not have direct..." should read "Subclasses do not have direct..."

Anonymous  Jun 21, 2011  Jun 24, 2011
Printed
Page 40
3rd paragraph

A sentence reads:

Note from the Author or Editor:
Replace the following sentence, "A subclass does have access to public, protected, and package members of the superclass." with the following two sentences, "A subclass does have access to public and protected members of the superclass. A subclass also has access to private members of the superclass where the same package is shared."

Matt Freake  Apr 04, 2009  Jun 24, 2011
Printed
Page 40
Bottom

The following statement... "The super keyword in the Curtain class's default constructor is to access..." should read "The keyword super in the Curtain class's default constructor is used to access..." * Note that the word 'used' was added and the words 'super' and 'keyword' were swapped.

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Sep 02, 2008  Oct 01, 2008
Printed
Page 42
After Builder class.

"<$endrange>" must have been automatically inserted during the document conversion process. This text should be removed.

Anonymous    Jun 24, 2011
Printed
Page 43
6th paragragh - code example

code: printRows() { for (int button: buttons) System.out.println(names); } should be (to continue the example of the section): printRows() { for (String name: names) System.out.println(name); }

Anonymous  Feb 19, 2009  Jun 24, 2011
Printed
Page 43
1st code example

You declare a method that accepts a String vararg, but in your method declaration you omitted the return type or void.

Note from the Author or Editor:
public setDisplayButtons (String... names) {...} should read public void setDisplayButtons (String... names) {...}

Erik Weibust  Oct 21, 2009  Jun 24, 2011
Printed
Page 52
various

The text: "(x == 1)" has an extra space and should read "(x == 1)"

Anonymous  Jun 21, 2011  Jun 24, 2011
PDF
Page 52
The if else if Statement section

amount == 20000; should read amount = 20000;

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Mar 02, 2010  Jun 24, 2011
Printed
Page 53
the header "Iteration Statements"

The header "Iteration Statements" is missing associated text. The following text should be added after the header, "Iteration statements are used for iterating through pieces of code."

Anonymous  Jun 21, 2011  Jun 24, 2011
Printed
Page 53
last paragraph

The sentence

Note from the Author or Editor:
Replace "The enhanced for loop... is used to iterate through an array or collection of any object that implements Iterable." with "The enhanced for loop... is used to iterate through an array or collection that implements Iterable."

Michael Callaghan  Jun 26, 2009  Jun 24, 2011
PDF
Page 55
Labeld block statement code, second for loop

I believe the second for statement printed as for (int c = 1; c <+ 18; c++) { should be for (int c = 1; c <= 18; c++) {

Note from the Author or Editor:
I agree.

Jean-Sebastien Gasse  May 23, 2012 
Printed
Page 78,79
Center

Both instances of "Standard Query Language" should read "Structured Query Language".

Note from the Author or Editor:
Confirmed as errata created by author.

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Jun 19, 2009  Jun 24, 2011
Printed
Page 87
Last paragraph

The ending forward slash is missing in this website address: http://java.sun.com/products/archive It should read: http://java.sun.com/products/archive/ (plus the period for the end of the sentence)

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Aug 30, 2008  Oct 01, 2008
Printed
Page 88
First Paragraph

Since J2SE 1.4.2 is basically EOSL (10/08) and J2SE 5.0 is reaching EOSL, the following text: J2SE version 1.3 has completed the Sun End of Life (EOL) process for the Solaris 9, Solaris 10, Windows and Linux platforms. should be replaced with: J2SE version 5.0 will have reached the Sun End of Service Life (EOSL) on October 30th, 2009.

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Aug 28, 2008  Oct 01, 2008
Printed
Page 89
various

"Java Server Pages" has an inappropriate space and should read "JavaServer Pages".

Anonymous  Jun 21, 2011  Jun 24, 2011
Printed
Page 98
Figure 11-1

Abstract classes, "Reader", "Writer", "FilterReader", "FilterWriter", "InputStream" and "OutputStream" should be italicized in UML, therefore Figure 11-1 should be updated.

Anonymous  Jun 21, 2011  Jun 24, 2011
Printed
Page 98
The first class on the right side should be Writer (not Reader). Note: It appears that this error was introduced by

cutting and pasting the left side of the diagram to the right, but not updating the class image.

Anonymous    May 01, 2008
Other Digital Version
98
The first class on the right side should be Writer (not Reader). Note: It appears that this error was introduced by

cutting and pasting the left side of the diagram to the right, but not updating the class image.

Anonymous    May 01, 2008
Printed
Page 106
various

"Sees whether a file exits" should read "Checks if a file exists".

Anonymous  Jun 21, 2011  Jun 24, 2011
Printed
Page 111
Various

Found in reprint [10/08] -- by author (Robert Liguori) Page 111, "Java Collections Framework: Collections class algorithms; Collections class algorithmsArrayList" should read "ArrayList".

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Jan 30, 2009  Jun 24, 2011
Printed
Page 111
table 12-5, first column, second row

About ArrayList operations: - get() and set() are listed as taking O(n) time - in fact they take O(1) time. - add() and remove() take O(1) as well, even if it's amortized. See for instance http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html - and I quote: "The size, isEmpty, get, set, iterator, and listIterator operations run in constant time. The add operation runs in amortized constant time, that is, adding n elements requires O(n) time. "

Note from the Author or Editor:
Modify row 1 from --------------------------------------------- | add, remove (from end) | ArrayList | O(1) | --------------------------------------------- to ----------------------------- get, set | ArrayList | O(1) | ----------------------------- Modify row 2 from --------------------------------------------------------- | get, set, add, remove (from index) | ArrayList | O(n) | --------------------------------------------------------- to -------------------------------- add, remove | ArrayList | O(n) | -------------------------------- These changes will align the table with the sited documentation (http://java.sun.com/j2se/1.4.2/docs/api/java/util/ArrayList.html) as well as the array list performance table (6.2) from Data Structures & Algorithms in Java, by Michael T. Goodrich and Roberto Tamassia (Wiley, 2006).

Anonymous  Aug 08, 2008  Oct 01, 2008
Printed
Page 112,113
Entire Code Listing

This is an unneccessary refinement, but will provide clarity for the reader. The existing code listing in the Comparator Interface section only sorts two elements (crayons). I have added two more crayons to be sorted in order to clarify through demonstration the underlying intent of the code, which is ordering. The entire code segment can be replaced with the following code segment: public class Crayon { private String color; public void setColor(String s) {color = s;} public String getColor() {return color;} public String toString() {return color;} } import java.util.Comparator; public class CrayonSort implements Comparator<Crayon> { public int compare (Crayon one, Crayon two) { return one.getColor().compareTo(two.getColor()); } } import java.util.ArrayList; import java.util.Collections; public class ComparatorTest { public static void main(String[] args) { Crayon crayon1 = new Crayon(); Crayon crayon2 = new Crayon(); Crayon crayon3 = new Crayon(); Crayon crayon4 = new Crayon(); crayon1.setColor("green"); crayon2.setColor("red"); crayon3.setColor("blue"); crayon4.setColor("purple"); CrayonSort cSort = new CrayonSort(); ArrayList <Crayon> cList = new ArrayList<Crayon>(); cList.add(crayon1); cList.add(crayon2); cList.add(crayon3); cList.add(crayon4); Collections.sort(cList, cSort); System.out.println("\nSorted:" + cList ); } } $ Sorted: [blue, green, purple, red]

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Aug 30, 2008  Oct 01, 2008
Printed
Page 114
Center of the page.

The references for the books about generics and UML should be stronger. (1) "See Java Generics and Collections, by Maurice Naftalin and Philip Wader (O'Reilly), for..." should read "See Java Generics and Collections, by Maurice Naftalin and Philip Wader (O'Reilly Media Inc., October 2006), for..." (2) "Comprehensive information on UML is covered in UML Distilled, Third Edition, by Martin Fowler (Addison-Wesley)." should read "Comprehensive information on UML is covered in UML Distilled, Third Edition, by Martin Fowler (Addison-Wesley Professional, September 2003)".

Note from the Author or Editor:
The UML reference is on page 149.

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Sep 02, 2008  Oct 01, 2008
Printed
Page 115
Last line

The statement that a

Note from the Author or Editor:
Add "public SpecialList(String s) {...}" after "public SpecialList() {...}" Replace "A generic object of this class could be instantiated as such: SpecialList<String> b = new SpecialList<String>("Joan Marie");" with "A generic object of this class could be instantiated as such: SpecialList<String> b = new SpecialList<String>();" Add to the end of this page, that is 'after' the above replacement: "If a constructor for a generic class includes a parameter type such as a String, the generic object could be instantiated as such: SpecialList<String> b = new SpecialList<String>("Joan Marie");"

Steve Etherington  Jun 16, 2009  Jun 24, 2011
Printed
Page 143, 146
The new tools should be placed alphabetically.

The following Java EE 5 application server should be added to the Web Applications Platforms list as it is maintained by Sun, open-source and very popular: Glassfish: https://glassfish.dev.java.net Glassfish is an open source Java EE server used for developing, integrating, and deploying applications, portals, and web services. The following tool should be added to the Development Tools list so there is CASE tools coverage: Enterprise Architect: http://www.sparxsystems.com/ Enterprise Architect is a commercial Computer Aided Software Engineering (CASE) tool that provides forward and reverse Java code engineering with UML. -- Robert Liguori, Author

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Aug 28, 2008  Oct 01, 2008
Printed
Page 145,146
The location for the necessary changes is apparent.

Sun now uses terminology of "Java EE" versus "J2EE". Therefore, in the Web Applications section of the Third Party Tools Chapter, five instances of "J2EE" should be changed to "Java EE". Here are the explict updates: Page 145: - BEA WebLogic Server is a commercial Java EE server... Page 146: - Geronimo is a Java EE server... - IBM WebSphere is a commercial Java EE server... - JBoss Application Server is an open source Java EE server... - Oracle Application Server is a commercial Java EE server...

Note from the Author or Editor:
Just FYI... This errata was entered twice, the write-up is identical. Additionally, the following changeds should be made: Page 144: - The Spring Framework is a layered Java/'Java EE' application framework. Page 145: - 'http://www.jetbrains.com/' should read 'http://www.jetbrains.com/idea/' Page 145: - 'http://www.borland.com/' should now read 'http://www.codegear.com/products/jbuilder'

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Aug 28, 2008  Oct 01, 2008
Printed
Page 145,146
The location for the necessary changes is apparent.

Sun now uses terminology of "Java EE" versus "J2EE". Therefore, in the Web Applications section of the Third Party Tools Chapter, five instances of "J2EE" should be changed to "Java EE". Here are the explict updates: Page 145: - BEA WebLogic Server is a commercial Java EE server... Page 146: - Geronimo is a Java EE server... - IBM WebSphere is a commercial Java EE server... - JBoss Application Server is an open source Java EE server... - Oracle Application Server is a commercial Java EE server... Note: I am the author, Robert Liguori

Note from the Author or Editor:
Just FYI... This errata was entered twice, the write-up is identical. Additionally, the following changeds should be made: Page 144: - The Spring Framework is a layered Java/'Java EE' application framework. Page 145: - 'http://www.jetbrains.com/' should now read 'http://www.jetbrains.com/idea/' Page 145: - 'http://www.borland.com/' should now read 'http://www.codegear.com/products/jbuilder'

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Aug 28, 2008  Oct 01, 2008
Printed
Page 145,146
As explained.

Oracle has acquired BEA Systems and their application server. Therefore, the BEA WebLogic text on page 145 should be removed completely from the book: BEA WebLogic Server: http://www.bea.com/ BEA WebLogic Server is a commercial J2EE server used for developing, integrating and deploying applications, portals and web services. The following original Oracle text should be changed: Oracle Application Server: http://www.oracle.com/appserver/ Oracle Application Server is a commercial J2EE server used for developing, integrating and deploying applications, portals and web services. The new Oracle text should read: Oracle WebLogic Application Server: http://www.oracle.com/appserver/ Oracle WebLogic Application Server is a commercial Java EE server used for developing, integrating and deploying applications, portals and web services.

Note from the Author or Editor:
To clarify, the original Oracle text is being 'replaced' by the new Oracle text. The original BEA Weblogic text is being completely removed.

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Aug 30, 2008  Oct 01, 2008
Printed, Other Digital Version
Page 157
class name

The class name on the right side should be ":Clarinet" (not ": Part"). Note: I believe this error was also introduced the same way (unmodified cut-and-paste).

Anonymous    May 01, 2008