Java in a Nutshell, Second Edition
The Java programming examples linked below are from the book
Java in a Nutshell, Second Edition, by David Flanagan,
published by O'Reilly & Associates.
If you are looking for the examples from the *first* edition
of Java in a Nutshell, click here.
Although you can view the example source code online, by following the
links below, I recommend that you download the complete set of examples
so that you can work with them on your computer locally. They are
available as a
or as a
gzipped tar file.
If you find any bugs in these examples, please send e-mail describing
the bug to firstname.lastname@example.org.
If you have found a workaround to the problem, please include it.
The examples were written by David Flanagan, and are Copyright (c) 1997
by O'Reilly and Associates.
You may study, use, and modify these examples for any purpose. This
means that you can use the examples, or modified versions of the
examples in your programs, and you can even sell those programs. You
can distribute the source code to these examples, but only for
non-commercial purposes, and only as long as the copyright notice is
retained. This means that you can make them available on a public Web
site, for example, but that you cannot include them on a commercial
CD-ROM without the prior permission of O'Reilly and Associates.
Note that these examples are provided AS-IS, with absolutely NO WARRANTY
of any kind, either expressed or implied.
an applet of intermediate complexity, used as an example in the
an application that demonstrates how to define, throw, and handle
exceptions. This application doesn't do anything other than print out
some text, but you might want to study it and play around with it to
learn more about how exceptions work in Java. See the usage instructions
in the source code.
the simplest possible applet. Displays "Hello World"
a fancier version of "Hello World"
a simple applet with user interaction. It allows the user to click and
scribble in the window.
the scribble applet, with colors specified through applet parameters in
an HTML file.
An applet that displays an image, plays a sound, and demonstrates
several other applet capabilities.
a simple applet, using the Java 1.0 event model.
the same applet, using the Java 1.1 event model.
the applet using the Java 1.1 event model and inner classes.
the applet using a low-level interface to the Java 1.1 event model.
a relatively long application that demonstrates many of the new AWT
features of Java 1.1, and also demonstrates object serialization and
a simple datatype that defines custom serialziation and de-serialization
behavior for itself.
a custom AWT component and Java Bean that displays a specified string of
text, using multiple lines, if the string contains newline characters.
a bean that displays a dialog box.
an event type used by the bean.
the event listener interface used by the bean
a BeanInfo class for the bean.
a property editor class for one of the bean's properties.
a property editor class for another of the bean's properties.
a customizer class for the bean.
an application that converts a file from one character encoding to another.
a dummy stock portfolio program that demonstrates internationalization
of dates, times and numbers.
a convenience class for simple creation of localized menus using
property files that specify default, British, and French resource
bundles for simple menu creation.
a class that displays a localized error message fora given exception
object, using the MessageFormat class.
a sample property file used by the previous example
a program that uses the Reflection API to show the fields and methods of
an ActionListener implementation that uses reflection to invoke a named
method of an object.
oreilly.com Home |
O'Reilly Bookstores |
How to Order |
About O'Reilly |
Affiliated Companies |
© 2001, O'Reilly & Associates, Inc.