book.html
| TOC
| CD-ROM
| References
| Errata
| Tutorial Trail Map
Errata (second edition) |
The following is a summary of the errors and ommissions that have been found in the first printing of the second edition of The Java Tutorial. If you find any that aren't listed here, please send them to tutorial@java.sun.com.
System.err
should be capitalized.
To compile the program change this line:
to this:system.err.println("Usage: Count filename");
System.err.println("Usage: Count filename");
continue
statement
continues at the next iteration of the labeled loop."
main
doesn't
have do". It should read "so main
doesn't have
to".
area
method is wrong.
It should read:
That is, thepublic int area() {
int x, int y
parameters should be removed.
hashCode
method is incorrectly listed as final.
hashCode
is not final and may be overridden by subclasses.
public
is misspelled as pubilc
.
return
statement is wrong. It should read:
That is, add the parentheses afterreturn new Enumeration () {
Enumeration
as shown.
Rectangle.java
.
Sent: Hi, PC Received: Hi, Sun
==
when it should
call the equals
method instead:
// IMPURE CODE! if (System.getProperty("os.name").equals("Solaris")) doSomething(); else if (System.getProperty("os.name").equals("Windows 95")) doSomethingElse();
getLine
.
It should refer instead to getWord
.
Thread
twice on the second line.
Thread
once on the second line.
read
Method in CheckedInputStream
class
should read like thiscksum.update(b, 0, b.length);
cksum.update(b, 0, len);
should be changed as indicated:ObjectOutputStream s = new ObjectOutputStream(f);
ObjectOutputStream s = new ObjectOutputStream(out);
tothisThread.sleep(interval);
TheThread.sleep(interval);
sleep
method is a class method that puts the
current thread to sleep. Calling it on a specific thread is misleading.
tothisThread.sleep(interval);
TheThread.sleep(interval);
sleep
method is a class method that puts the
current thread to sleep. Calling it on a specific thread is misleading.
toThread.currentThread().sleep(interval);
TheThread.sleep(interval);
sleep
method is a class method that puts the
current thread to sleep. Calling it on a specific thread is misleading.
book.html
| TOC
| CD-ROM
| References
| Errata
| Tutorial Trail Map