Preface to the First Edition


If you know a little Java, great. If you know more Java, even better! This book is ideal for anyone who knows some Java and wants to learn more. If you don't know any Java yet, you should start with one of the more introductory books from O'Reilly, such as Head First Java or Learning Java if you're new to this family of languages, or Java in a Nutshell if you're an experienced C programmer.

I started programming in C in 1980 while working at the University of Toronto, and C served me quite well through the 1980s and into the 1990s. In 1995, as the nascent language Oak was being renamed Java, I had the good fortune to be told about it by my colleague J. Greg Davidson. I sent an email to the address Greg provided, and got this mail back from James Gosling, Java's inventor, in March 1995:

> Hi. A friend told me about WebRunner(?), your extensible network > browser. It and Oak(?) its extension language, sounded neat. Can > you please tell me if it's available for play yet, and/or if any > papers on it are available for FTP?   Check out http://java.sun.com (oak got renamed to java and webrunner got renamed to  hotjava to keep the lawyers happy)

I downloaded HotJava and began to play with it. At first I wasn't sure about this newfangled language, which looked like a mangled C/C++. I wrote test and demo programs, sticking them a few at a time into a directory that I called javasrc to keep it separate from my C source (because often the programs would have the same name). And as I learned more about Java, I began to see its advantages for many kinds of work, such as the automatic memory reclaim and the elimination of pointer calculations. The javasrc directory kept growing. I wrote a Java course for Learning Tree,[2] and the directory grew faster, reaching the point where it needed subdirectories. Even then, it became increasingly difficult to find things, and it soon became evident that some kind of documentation was needed.

[2] One of the world's leading high-tech, vendor-independent training companies; see http://www.learningtree.com/.

In a sense, this book is the result of a high-speed collision between my javasrc directory and a documentation framework established for another newcomer language. In O'Reilly's Perl Cookbook, Tom Christiansen and Nathan Torkington worked out a very successful design, presenting the material in small, focused articles called "recipes." The original model for such a book is, of course, the familiar kitchen cookbook. Using the term "cookbook" to refer to an enumeration of how-to recipes relating to computers has a long history. On the software side, Donald Knuth applied the "cookbook" analogy to his book The Art of Computer Programming (Addison Wesley), first published in 1968. On the hardware side, Don Lancaster wrote The TTL Cookbook (Sams, 1974). (Transistor-transistor logic, or TTL, was the small-scale building block of electronic circuits at the time.) Tom and Nathan worked out a successful variation on this, and I recommend their book for anyone who wishes to, as they put it, "learn more Perl." Indeed, the work you are now reading strives to be the book for the person who wishes to "learn more Java."

The code in each recipe is intended to be largely self-contained; feel free to borrow bits and pieces of any of it for use in your own projects. The code is distributed with a Berkeley-style copyright, just to discourage wholesale reproduction.



Java Cookbook
Java Cookbook, Second Edition
ISBN: 0596007019
EAN: 2147483647
Year: 2003
Pages: 409
Authors: Ian F Darwin

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net