Java Reference
In-Depth Information
Appendix C
Javadoc Comments and the Java API Specification
The Java API Specification
Java's Application Programming Interface (API) Specification is a set of web pages
that describe the classes, interfaces, and methods of the Java class libraries. You can
use these pages to learn class and method names or to find details about a particular
method. The API pages can be thought of as a contract between the authors of the
class libraries and you, the client of those classes.
The API pages exemplify the idea of the public view of a class versus its private
implementation. Each class has a set of constructors, constants, and methods that its
clients can access and use. The class also has private fields, methods, and method
bodies that are used to actually implement the behavior specified in the public inter-
face. The main benefit of this separation is that you don't need to know the private
implementation of the class libraries to be able to use them.
As of this writing, the current Java API Specification pages can be accessed from
the following URL:
http://java.sun.com/javase/6/docs/api/
(Each new version of Java has a new specification, so this URL will change as
new versions are released.) When you visit the API pages you'll see a screen that
looks like Figure C.1.
The main frame of the page (on the right) shows information about classes that you
can select using the frames on the left. The lower-left frame lists all of the classes and
interfaces, and the upper-left frame lists all of the packages in the class libraries.
Recall that packages are groups of related classes that you can use in your program by
importing them. If you're looking for a class from a particular package, you can click
that package's name in the top-left frame to filter the results in the bottom-left frame.
Once you click a class name in the bottom-left frame, information about that class
appears in the main frame. At the start of the page you'll see a tree showing the names of
any superclasses and any interfaces that it implements, the class's header, and a summary
description of the class. The summary description gives general information about the
purpose and usage of the class and may link to other relevant documentation or tutorials.
An ordered list of the contents of the class follows the summary. Listed first will be
any public fields and class constants. Next will be the class's constructors, followed by
its methods. Each field, method, and constructor has a line showing information such
1122
 
 
Search WWH ::




Custom Search