Examplets are code snippets that illustrate a particular task.
They're designed to show which classes and members are involved
in performing the task, and
how the classes and members interact
with each other. You will see blue italicized text in an
examplet; this indicates code that should be replaced if you use
it in
your program.
An examplet can have enough detail for you to use
it, as is.
Or you might have to get more information about the involved classes.
A good place to find information about the Java 2 Platform APIs
is the
Java 2 Platform API index.
It's also good practice to add catch clauses, as appropriate,
to the examplets. If the code of an examplet throws a checked exception,
the code is
surrounded by a try/catch statement. However, to reduce space and
distraction, the catch clause is left blank. Catch clauses should
always handle the exception and should never be left
blank. So, at the very least, you should include a call to
e.printStackTrace()
to display the exception on the console.
You'll find examplets in a variety of categories.
See the Table of Contents for a list of
categories, and the examplets in each category.