Java in a Nutshell

Errata for Java in a Nutshell

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.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

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

Version Location Description Submitted by Date submitted
Mobi Location 225

The text reads "simultenously". It should read "simultaneously".

Fernando Montenegro  Jul 29, 2015 
PDF Page 9
2nd paragraph, bellow Figure 1-1

"This starts wth Java source, "

must become:

"This starts with Java source, "

Mohsen Mirhoseini Argi  Jan 01, 2017 
Printed Page 31
3rd line from below

... the unary Operators have right-to-left associativity.

does not hold for all unary Operators, as shown in table 2-4 on the following page 32, precedence 16.

Dr. Horst Schirmeier  Apr 09, 2015 
PDF Page 36
1st Paragraph

Line 4 of the page reads:

operator are evaluated first. As the operands of ++ are both a+, these are evaluated

It should read:

operator are evaluated first. As the operands of + are both ++a, these are evaluated

Anonymous  Dec 07, 2015 
Printed Page 37
2nd paragraph

The unary minus operator '-' not only performs unary negation of the value of ist operand. It also performs a so-called unary numeric promotion is performed on the Operand.

The same holds for the unary plus operator. (Lang.Ref. ยง 15.15.3).

The code

char a = 'x', b = +a;

effects a compile-time error, since +a is of type int.

Dr. Horst Schirmeier  Apr 09, 2015 
Printed Page 144
Last line

put in is the sane type

should read

put in is the same type

Graham Norris  Jun 08, 2016 
PDF Page 144
last paragraph

In the sixth edition, a portion of the last sentence of page 144 reads 'put in is the sane type'. I believe that should be 'same' not 'sane' - although we also do want the type to be sane!

Smolenski  Aug 18, 2019 
Printed Page 150
1st paragraph of "Compile and Runtime typing"

Consider an example piee>ce of code:

should read

Consider an example piece of code:

Graham Norris  Jun 08, 2016 
PDF Page 159
2nd bullet point in Non Static Member Classes

You wrote: "Only classes can be nonstatic member types."

This is incorrect. Other non static types like interfaces and enums can also be non static member types. For example, the following compiles fine with Java 8 on my system.

class Outer {
interface INonStaticInner { }
enum Color { Red, Green, Blue; }

Nicholas Mahbouby  Sep 14, 2017 
Printed Page 194
Last paragraph

The text says:

Finally, two exception handling antipatterns that you should avoid:

<...example 1...>

// Never catch, log and rethrow an exception
try {
} catch(SpecificException e){
throw e;


The second one just creates noise - we're logging a message but not actually doing anything about the issue - we still requires some other code higher up in the system to actually deal with the problem.

===> But you don't actually suggest what the correct pattern is, from earlier in the book, what the programmer *should* do here is decorate the exception to add the "logging" information:

try {
} catch(SpecificException e){
throw new OurException("Something we were logging", e);

Alun Evans  Aug 22, 2016 
ePub Page 201
Code sample, inside createLocalObject() method

The code sample for local classes (nested types) contains the following variable declaration and comment:

int i = 0; // i not final; not usable by local class

Since 'i' is assigned its value ONCE, it is effectively final, and the value is "usable" by he local class "Local." If the class "Local" had tried to assign a value to 'i', it would be a compiler error. However, merely printing or accessing the value of 'i' is perfectly legal in Java 8.

Anonymous  Aug 28, 2017 
Printed Page 301
Second subheading

The second subheading is "Future-Based Style" which is followed by "We''ll meet the Future interface in detail in Chapter 11".

There is no reference to any Future interface in chapter 11, nor in fact anywhere else I can find in the entire book.

Graham Norris  Mar 12, 2021 
ePub, Mobi Page 11682

There is an typo in source code example:

String absName = f.getAbsolutePath();
String canName = f.getCanonicalPath();
String name = f.getName();
String pName = getParent();
URI fileURI = f.toURI(); // Create URI for File path

the following line String pName = getParent(); It should be "f.getParent()" instead of just "getParent()"

Anton Balaniuc  Feb 01, 2016