Java Cookbook, 2nd Edition gets you to the heart of what you need to know when you need to know it. The completely revised and updated recipes in Java Cookbook, 2nd Edition cover all of the major APIs from Java 1.4 as well as the new 1.5 version. It includes many specialized APIs--like those for working with Struts, Ant, and other Open Source tools--and delivers expanded Mac OS coverage.
Unlike my Perl colleagues Tom and Nathan, I don't have to spend as much time on the oddities and idioms of the language; Java is refreshingly free of strange quirks. But that doesn't mean it's trivial to learn well! If it were, there'd be no need for this book. My main approach, then, is to concentrate on the Java APIs. I'll teach you by example what the APIs are and what they are good for.
Like Perl, Java is a language that grows on you and with you. And, I confess, I use Java most of the time nowadays. Things I'd once done in C are now—except for device drivers and legacy systems—done in Java.
But Java is suited to a different range of tasks than Perl. Perl (and other scripting languages, such as awk and Python) are particularly suited to the "one-liner" utility task. As Tom and Nathan show, Perl excels at things like printing the 42nd line from a file. While it can certainly do these things, Java, because it is a compiled, object-oriented language, seems more suited to "development in the large" or enterprise applications development. Indeed, much of the API material added in Java 2 was aimed at this type of development. However, I will necessarily illustrate many techniques with shorter examples and even code fragments. Be assured that every line of code you see here has been compiled and run.