Java in a Nutshell
David Flanagan's Java in a Nutshell has quality stamped on its cover and embedded in its acid-free paper. O'Reilly has a reputation for books with terse, accessible writing&emdash;and this book is no exception.
The book has 33 sections, a glossary, and an index. The first three sections introduce Java. The next six sections contain examples of applets, GUIs, I/O, networking, advanced graphics, and threads. The examples get gradually harder within the sections, but not necessarily from section to section. That's it, except for the "Java Language Reference," "API Reference," and "API Cross-Reference," and months of further study. All in all, I like the tone, topics, examples, level of detail, and the layout.
"How Java Differs From C" exhibits the tone of the book. Flanagan minces no words as he pursues packages, CLASSPATH, imports, types, objects, garbage collection, and exceptions from the point of view of a C programmer. Java is more like C than C++, he says.
The FileViewer example views a text file with the file name as a command-line parameter. It worked the first time. I converted FileViewer to an applet by adding an init() method and deleting main(). I converted the command-line parameter to a <PARAM> tag in an HTML file, and added the code to read in the file name as a String. This worked well with the AppletViewer under Windows 95, but the JDK on a Power Mac 6100 (Java Version 1.0b2) quit with a NullPointerException on the line loading the file name.
The GUI section introduces class InfoDialog, then adds a user response with Yes/No/Cancel buttons. This demonstrates use of a widget and response to events via an action() and answer() method. All the high-quality examples can be downloaded from http://www.ora.com/catalog/javanut.
Java in a Nutshell is well laid out. The examples contain many cross-references, and the tabs on the page ends make locating sections easy. This is a detailed volume, with more in it than I can describe here&emdash;check out the section on Unicode.
There was a glitch in the book in Section 3, page 68, that incorrectly implied that you can overload methods by merely defining a method with a different return type (same name and parameters). After I read about this on the errata sheet on the web page, I looked for it in the other books. (Just Java makes the correct point very clearly, for example.)
I'm sure this book will meet the needs of programmers everywhere who want to get up to speed with Java.--Dr. Dobb's Electronic Review of Computer Books