p. 27: The last closing brace is missing from Example 2-1. The complete example should be:
import java.io.*;
public class AsciiChart {
public static void main(String[] args) {
for (int i = 32; i < 127; i++) {
System.out.write(i);
// break line after every eight characters
if (i % 8 == 7) System.out.write('\n');
else System.out.write('\t');
}
System.out.write('\n');
}
}
FYI: This is correct in the online example.
p. 29: In the section on flushing and closing,
I made too many assumptions that Java and C meant the same thing by flush()
.
I should know better by now. (In my defense, this section was written very early on when Sun's documentation on this point was a lot less clear than it is now.) In any case, in Java the flush()
method only flushes Java's own buffers
such as those provided by java.io.BufferedOutputStream
. It does not flush OS
or hardware buffers. That can be done by the sync()
method in
java.io.FileDescriptor
.