Java 7 Pocket Guide

Errata for Java 7 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 8
in ASCII character table

the character for 99 should be lower case 'c' - not capital. and character for 115 should be lower case 's' - not capital

Note from the Author or Editor:
Agreed, these changes should be made

Angelo Quaglia  Mar 31, 2014 
PDF, ePub
Page 21
3rd paragraph (examples with floats)

The text says "No explicit cast is necessary for an int literal because an int fits in a float .". While it's true when casting an int to a double, it's actually false when casting an int to a float. See http://stackoverflow.com/a/2781125 for a detailled explanation.

Note from the Author or Editor:
I made this change for the Java 8 Pocket Guide: Even though no explicit cast is necessary for an +int+ literal, an +int+ will not always fit into a +float+ where the value exceeds about 2^23. Thank you.

Mathieu Olivier  Jan 28, 2014 
Printed
Page 22
Table 3-2, row 3, last column

The second example "-1e300/1e300" evaluates to -1, not -0.0 I think it should read "-1e-300/1e300" instead.

Note from the Author or Editor:
Yes, it should read "-1e-300/1e300" instead. Thank you.

D K  Aug 30, 2013  Oct 25, 2013
Printed
Page 34
last code block

Method defined as follows: void modChairCount(int 1) { 1 = 10; } Identifier name cannot be 1.

Note from the Author or Editor:
void modChairCount(int 1) { 1 = 10; } should read void modChairCount(int i) { i = 10; }

Sergey Stolyarov  Jul 13, 2013  Aug 02, 2013
ePub
Page 34
last code block

This error has already been reported and corrected for the PDF version, but it's still present in the ePub version. void modChairCount(int 1) { 1 = 10; } should read void modChairCount(int i) { i = 10; }

Note from the Author or Editor:
The change is going into the Java 8 Pocket Guide. Thank you.

Mathieu Olivier  Jan 28, 2014 
Printed
Page 34
middle

The text starting with "table.setLength(72);" to the end needs to be shift left. There is an extra close bracket at the end.

Note from the Author or Editor:
Formatting is off and last '}' should be dropped... should look like: void roomSetup() { // Reference passing Table table = new Table(); table.setLength(72); // Length will be changed modTableLength(table); // Primitive passing // Value of chairs not changed int chairs = 8; modChairCount(chairs); } void modTableLength(Table t) { t.setLength(36); } void modChairCount(int i) { i = 10; } This will be changed in the Java 8 Pocket Guide, thank you.

Steve Rhoads  Mar 17, 2014 
Printed
Page 39
middle

There is an extra close bracket. I believe that "} // end" should be deleted.

Note from the Author or Editor:
} catch (CloneNotSupportedException cnse) should read } catch (CloneNotSupportedException cnse) { So, we need to add a bracket, not remove one. This will be added to the Java 8 Pocket Guide.

Steve Rhoads  Mar 17, 2014 
Printed
Page 47
Lower

The class Curtain contains executable statements outside of a method(). Is this valid?

Note from the Author or Editor:
Replaced this: public class Curtain { Builder builder = new Builder(); builder.setWallType(this); } with this: // Print the contents of class curtain System.out.println(this); in the Java 8 Pocket Guide. Thank you for the observation.

Steve Rhoads  Mar 17, 2014 
PDF
Page 49
first code block

Indentation for first code block looks a little confusing: printRows() { for (String name: names) System.out.println(name); }

Note from the Author or Editor:
The code should be formatted as shown: printRows() { for (String name : names) System.out.println(name); } optionally, it can be shown with parentheses: printRows() { for (String name : names) { System.out.println(name); } } For the next printing of the book, I will leave it up to the discretion of the publisher.

Sergey Stolyarov  Jul 13, 2013  Aug 02, 2013
PDF
Page 52
last code block

There is an incorrect definition of enumeration: class enum DisplayButton { "class" keyword is not needed here.

Note from the Author or Editor:
class enum DisplayButton { should read enum DisplayButton {

sigsergv  Jul 13, 2013  Aug 02, 2013
PDF
Page 53
the last paragraph

The last paragraph: Because @Override is a marker annotation, a compile warning will be returned if the toString() method cannot be found: But instead of "toString" there should be "tooString", I think.

Note from the Author or Editor:
Because @Override is a marker annotation, a compile warning will be returned if the toString() method cannot be found: should read: Because @Override is a marker annotation, a compile warning will be returned if the method to be overridden cannot be found. --------------------------------- In addition, on page 54, the two comments and 4 lines of code at the top of the page (six lines total) should be removed.

sigsergv  Jul 13, 2013  Aug 02, 2013
Printed
Page 54
last two code blocks

In one code block there is a method myMethod, but in the next - someMethod. Looks a little inconsistent.

Note from the Author or Editor:
Feedback fb = someMethod.getAnnotation(Feedback.class); should read: Feedback fb = myMethod.getAnnotation(Feedback.class);

sigsergv  Jul 13, 2013  Aug 02, 2013
Printed
Page 62
bottom

Should "strings >= 4 & strings <= 8" be changed to "strings >=4 && strings <= 8"?

Note from the Author or Editor:
Excellent, thank you... yes short circuit operators would be best suited here. This will change and the one on the next page, in the the Java 8 Pocket Guide.

Steve Rhoads  Mar 17, 2014 
PDF
Page 103
4th paragraph

Based on the command in the first line of the paragraph: javac -d /opt/hwapp/classes HelloWorld.java (i.e., /opt/hwapp/src/com/oreilly/tutorial/) should read: (i.e., /opt/hwapp/classes/com/oreilly/tutorial/)

Note from the Author or Editor:
I made the update into the Java 8 Pocket Guide. Thank you.

Ryan Gomoto  Nov 01, 2013 
Printed
Page 147
All code

The Java code on pages 147 and 148 should be appropriately formatted, as was done in the previous edition.

Robert James Liguori
Robert James Liguori
O'Reilly Author 
Jul 30, 2013  Aug 02, 2013