Errata

Java Language Reference

Errata for Java Language Reference

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
Printed Page 23
there is a syntax diagram for comments. The following character

strings would not be accepted as comments by that diagram:

/* This is a comment **/

/**********************/

/***/

Either these strings are not valid Java comments, or the diagram is in
error. Here is my proposal for a diagram that would also accept those
strings. I do not include the possibility of single-line comments,
since the corresponding part of the diagram in the book seems correct.

-<- NotStar -<- ---<---
| | | |
| | | |
|--- / --- * -------------------------------------- * --------- / ----|
| |
| |
---<---- NeitherStarNorSlash ----<-------

Anonymous   
Printed Page 61, 127
The text states an anonymous class can only use the default

constructor. Although this seems logical according to the reasons
given, it is not true. An anonymous class can use a parameterised
constructor defined in the class from which it is derived (if it
is derived from a class instead of an interface).

An example is given by Arnold & Gosling in "The Java Programming
Language 2nd Edition" [Addison Wesley].

Anonymous   
Printed Page 141
First paragraph, fifth sentence.

static

The book states:

"A method that is declared static is also implicitly final, or in other
words, static methods cannot be overridden."

But, that is not correct.

Static methods can be overridden! But a static method can only be
overridden by another static method.

example:

class A { static void foo() {} }
class B extends A { public static void foo() {} }

This code compiles fine. Try it.

Anonymous   
Printed Page 156
In the example program "class foo" the class name "Frame" is

written with a lower case 'f', i.e. "static frame f = new Frame();"

Anonymous   
Printed Page 180
para. -1, line -1: "an if statement" should be "an else clause"

so that the paragraph reads

"When if statements are nested, each else clause is matched with the
last preceding if statement in the same block that has not yet been
matched with an else clause."

Anonymous   
Printed Page 194
the try statement that is given as an example would not be

accepted by the syntax diagram on the same page. That diagram does
not accept a statement that contains both one or more catch clauses
and a finally clause. Here is my proposal for the diagram:

|--- try --- Block ------- CatchClause -----------------------------------|
| | | | |
| | | | |
| -----<--------- ---- finally --- Block ----
| |
| |
------------------------

Anonymous