TechBookReport logo



Keywords: Java, tutorial, source code

Title: Java Examples In A Nutshell

Author: David Flanagan

Publisher: O'Reilly

ISBN: 0596006209

Media: Book

Level: Intermediate

Verdict: A great resource of code examples

Learning by looking at other people's code is always an effective and useful learning strategy. Not only does it help to solve specific problems, but it's a great way to pick up useful language idioms, pointers to good style and best practices. There's a proviso, of course, and that is that you're looking at code that contains good language idioms, is coded in a good style and to best practices. The net is awash with source code to look at, but the quality varies from the diabolically good to the inexorably awful. All of which is a roundabout way of introducing David Flanagan's 'Java Examples In a Nutshell'.

While the book is subtitled 'A Tutorial Companion to Java in a Nutshell', the book certainly can standalone as a very useful collection of practical Java examples - 193 complete programs in all. Ranging from the absolute basics to advanced topics such as reflection and RMI, all arranged in 21 chapters in four sections: Learning Java, Core Java APIs, Desktop Java APIs and Enterprise Java APIs. In terms of scope there's a lot here, including a wide of coverage of GUI programming, networking, problem areas like printing and an introduction to databases.

Aside from the code each example is preceded with a written explanation of the problem that the code is tackling, any special things to note, pointers on the API etc. This is good because it puts the examples in context and helps to high-light particularly difficult issues that can arise. As a way of getting into a new area or a new API this really works, more so than looking at isolated snippets of code. Having complete, working examples that accomplish some useful function is also a great incentive for learning by tinkering and extending code, rather than struggling to build something from scratch.

Of course it's the code which is where the book earns its keep. Not only are we getting complete examples, which we can download, compile and run, we're also getting code that is fully commented and is therefore pretty much self-documenting. It's also worth noting that many of these examples build on other examples, making good use of object-orientation, which adds to the value of the code as a learning resource.

Of course there are bound to be quibbles. The major annoyance, for this reader at least, is that the example index in chapter 22 does not include page numbers. This is a shame as it's a useful cross-reference. Say you want to find some code that uses regular expressions, you can look this up here and be pointed to a couple of the examples, but there are no page numbers only the example numbers. It's no big deal but a pointer to the starting page for the example would have been more user-friendly.

That aside, this is a book that can be recommended as a good reference and one that beginning Java programmers are likely to find most useful once they've gone beyond the basics.


Hit the 'back' key in your browser to return to subject index page

Return to home page